// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, DockerCommandsDbSeeder dockerCommandsDbSeeder, CustomersDbSeeder customersDbSeeder) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } //app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear()); // Route all unknown requests to app root // app.Use(async (context, next) => // { // await next(); // // Handle Angular routes which won't work on the server-side // if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value)) // { // context.Request.Path = "/index.html"; // await next(); // } // }); // Serve wwwroot as root app.UseFileServer(); // Serve /node_modules as a separate root (for packages that use other npm modules client side) app.UseFileServer(new FileServerOptions() { // Set root of file server FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "node_modules")), RequestPath = "/node_modules", EnableDirectoryBrowsing = false }); app.UseStaticFiles(); // Enable middleware to serve generated Swagger as a JSON endpoint app.UseSwagger(); // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.) app.UseSwaggerUi(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); //https://github.com/aspnet/JavaScriptServices/blob/dev/samples/angular/MusicStore/Startup.cs routes.MapSpaFallbackRoute("spa-fallback", new { controller = "Customers", action = "Index" }); // routes.MapRoute( // name: "spa-fallback", // template: "{*anything}", // defaults: new { controller="Customers", action="Index" }); }); customersDbSeeder.SeedAsync(app.ApplicationServices).Wait(); dockerCommandsDbSeeder.SeedAsync(app.ApplicationServices).Wait(); }