diff --git a/AspNetCore/React/AdvancedSearch/EqDemo.AspNetCoreReact.AdvancedSearch.csproj b/AspNetCore/React/AdvancedSearch/EqDemo.AspNetCoreReact.AdvancedSearch.csproj index 40bb9e61..46665bf1 100644 --- a/AspNetCore/React/AdvancedSearch/EqDemo.AspNetCoreReact.AdvancedSearch.csproj +++ b/AspNetCore/React/AdvancedSearch/EqDemo.AspNetCoreReact.AdvancedSearch.csproj @@ -1,20 +1,22 @@ - net6.0 + net8.0 true Latest false ClientApp\ + npm start + http://localhost:3000 $(DefaultItemExcludes);$(SpaRoot)node_modules\** EqDemo.AspNetCoreReact.AdvancedSearch true - - - - - + + + + + @@ -34,7 +36,7 @@ - + @@ -57,13 +59,13 @@ - + - %(DistFiles.Identity) + wwwroot\%(RecursiveDir)%(Filename)%(Extension) PreserveNewest - \ No newline at end of file + diff --git a/AspNetCore/React/AdvancedSearch/Startup.cs b/AspNetCore/React/AdvancedSearch/Startup.cs index 6ea66069..9433d075 100644 --- a/AspNetCore/React/AdvancedSearch/Startup.cs +++ b/AspNetCore/React/AdvancedSearch/Startup.cs @@ -2,7 +2,6 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.DependencyInjection; @@ -43,12 +42,6 @@ public void ConfigureServices(IServiceCollection services) services.AddControllersWithViews(); - // In production, the React files will be served from this directory - services.AddSpaStaticFiles(configuration => - { - configuration.RootPath = "ClientApp/build"; - }); - services.AddEasyQuery() .UseSqlManager() .AddDefaultExporters() @@ -78,10 +71,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseCors("AllowAllPolicy"); app.UseHttpsRedirection(); + app.UseDefaultFiles(); app.UseStaticFiles(); - if (!env.IsDevelopment()) { - app.UseSpaStaticFiles(); - } app.UseRouting(); @@ -103,15 +94,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); - }); - - app.UseSpa(spa => - { - spa.Options.SourcePath = "ClientApp"; - if (env.IsDevelopment()) { - spa.UseReactDevelopmentServer(npmScript: "start"); - } + endpoints.MapFallbackToFile("index.html"); }); //Init demo database (if necessary)