// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserManager <FullStoqUser> userManager, RoleManager <FullStoqRole> roleManager) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/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(); } var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(options => options.RouteTemplate = swaggerOptions.JsonRoute); app.UseSwaggerUI(options => options.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.ApiDescription)); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSession(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); SetupRolesAndUsers(userManager, roleManager); app.UseCors("GeneralPolicy"); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapControllerRoute( name: "api", pattern: "api/{controller=Home}/{action=Index}/{id?}"); }); //var enUsCulture = new CultureInfo("en-US"); //var localizationOptions = new RequestLocalizationOptions() //{ // SupportedCultures = new List<CultureInfo>() // { // enUsCulture // }, // SupportedUICultures = new List<CultureInfo>() // { // enUsCulture // }, // DefaultRequestCulture = new RequestCulture(enUsCulture), // FallBackToParentCultures = false, // FallBackToParentUICultures = false, // RequestCultureProviders = null //}; //app.UseRequestLocalization(localizationOptions); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseStaticFiles(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description); }); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseCors(VueCorsPolicy); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/FantasyDreamWorlds/swagger.json", "FantasyDreamWorlds API"); c.RoutePrefix = string.Empty; c.InjectStylesheet("/swagger-ui/SwaggerStyle.css"); }); app.UseFileServer(new FileServerOptions { FileProvider = new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory())), RequestPath = "/assets", EnableDirectoryBrowsing = true, StaticFileOptions = { ServeUnknownFileTypes = true } }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/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(); } var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(options => options.RouteTemplate = swaggerOptions.JsonRoute); app.UseSwaggerUI(options => options.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.ApiDescription)); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCors("GeneralPolicy"); app.UseRouting(); app.UseAuthentication(); app.UseCors("GeneralPolicy"); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } // swagger settings var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description); }); // app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCors(builder => { builder .AllowAnyOrigin() .AllowCredentials() .AllowAnyMethod() .AllowAnyHeader(); }); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOptions.UIEndpoint, swaggerOptions.Description); }); app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader()); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }