// 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(); app.UseDatabaseErrorPage(); } 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(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); 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.Description); }); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapRazorPages(); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, AppDbContext context) { if (env.IsEnvironment("E2ETests")) { context.Database.EnsureDeleted(); context.Database.Migrate(); } if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAuthentication(); var swaggerOptions = new Options.SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(options => options.RouteTemplate = swaggerOptions.JsonRoute); app.UseSwaggerUI(options => { options.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description); }); app.UseMvc(); }
// 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 { // 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.UseStaticFiles(); var swaggerOptions = new Options.SwaggerOptions(); Configuration.GetSection(nameof(Options.SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOptions.UIEndpoint, swaggerOptions.Description); }); app.UseAuthentication(); app.UseMvc(); }
// 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(); } //adiciona o middleware de autenticação app.UseAuthentication(); var swaggerOptions = new Options.SwaggerOptions(); Configuration.GetSection(nameof(Options.SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description); }); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseMvc(); }
// 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(); ////app.UseDatabaseErrorPage(); } 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 Options.SwaggerOptions(); Configuration.GetSection(nameof(Options.SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(options => { options.SwaggerEndpoint(swaggerOptions.UIEndpoint, swaggerOptions.Description); }); app.UseHttpsRedirection(); app.UseStaticFiles(); ////app.UseCookiePolicy(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Swagger}/{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(); // app.UseDatabaseErrorPage(); } else { //no need to have mvc related settings here as its web api project //app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } /****************************SWAGGER CONFIGURATION**********************************/ var swaggerOptions = new Options.SwaggerOptions(); Configuration.GetSection(nameof(Options.SwaggerOptions)).Bind(swaggerOptions); //setting a custom route for swagger json endpoint app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(options => { options.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description); }); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAuthentication(); //app.UseCookiePolicy(); //app.UseAuthentication(); 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, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } 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); // name is Description }); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAuthentication(); // TODO: Elfocrash - will change this later app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }