forked from BlazorRepl/BlazorRepl
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aaa20db
commit 34f7d44
Showing
2 changed files
with
39 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,48 @@ | ||
using MudBlazor.Examples.Data; | ||
|
||
namespace TryMudBlazor.Server; | ||
|
||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
public static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
var builder = WebApplication.CreateBuilder(args); | ||
builder.Services.AddScoped<IPeriodicTableService, PeriodicTableService>(); | ||
builder.Services.AddCors(options => | ||
{ | ||
options.AddDefaultPolicy(policy => | ||
{ | ||
webBuilder.UseStartup<Startup>(); | ||
policy.WithOrigins("https://www.mudblazor.com", "https://mudblazor.com"); | ||
}); | ||
}); | ||
builder.Services.AddControllers(); | ||
|
||
var app = builder.Build(); | ||
|
||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
app.UseWebAssemblyDebugging(); | ||
} | ||
else | ||
{ | ||
app.UseExceptionHandler("/Error"); | ||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | ||
app.UseHsts(); | ||
} | ||
app.UseHttpsRedirection(); | ||
|
||
app.UseRouting(); | ||
|
||
app.UseCors(); | ||
|
||
// Needed for wasm project | ||
app.UseBlazorFrameworkFiles(); | ||
app.UseStaticFiles(); | ||
|
||
app.MapControllers(); | ||
app.MapFallbackToFile("index.html"); | ||
|
||
app.Run(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.