File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using MudBlazor . Examples . Data ;
2+
13namespace TryMudBlazor . Server ;
24
35public class Program
46{
57 public static void Main ( string [ ] args )
68 {
7- CreateHostBuilder ( args ) . Build ( ) . Run ( ) ;
8- }
9-
10- public static IHostBuilder CreateHostBuilder ( string [ ] args ) =>
11- Host . CreateDefaultBuilder ( args )
12- . ConfigureWebHostDefaults ( webBuilder =>
9+ var builder = WebApplication . CreateBuilder ( args ) ;
10+ builder . Services . AddScoped < IPeriodicTableService , PeriodicTableService > ( ) ;
11+ builder . Services . AddCors ( options =>
12+ {
13+ options . AddDefaultPolicy ( policy =>
1314 {
14- webBuilder . UseStartup < Startup > ( ) ;
15+ policy . WithOrigins ( "https://www.mudblazor.com" , "https://mudblazor.com" ) ;
1516 } ) ;
17+ } ) ;
18+ builder . Services . AddControllers ( ) ;
19+
20+ var app = builder . Build ( ) ;
21+
22+ if ( app . Environment . IsDevelopment ( ) )
23+ {
24+ app . UseDeveloperExceptionPage ( ) ;
25+ app . UseWebAssemblyDebugging ( ) ;
26+ }
27+ else
28+ {
29+ app . UseExceptionHandler ( "/Error" ) ;
30+ // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
31+ app . UseHsts ( ) ;
32+ }
33+ app . UseHttpsRedirection ( ) ;
34+
35+ app . UseRouting ( ) ;
36+
37+ app . UseCors ( ) ;
38+
39+ // Needed for wasm project
40+ app . UseBlazorFrameworkFiles ( ) ;
41+ app . UseStaticFiles ( ) ;
42+
43+ app . MapControllers ( ) ;
44+ app . MapFallbackToFile ( "index.html" ) ;
45+
46+ app . Run ( ) ;
47+ }
1648}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments