samples/server/petstore/aspnetcore/src/IO.Swagger/Startup.cs
/// <summary>
/// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
/// </summary>
/// <param name="app"></param>
/// <param name="env"></param>
/// <param name="loggerFactory"></param>
This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
This method gets called by the runtime . Use this method to configure the HTTP request pipeline .
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseRouting();
            app.UseAuthorization();
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/1.0.0/swagger.json", "Swagger Petstore");
            });
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }
        }
public void Configure ( IApplicationBuilder app , IWebHostEnvironment env , ILoggerFactory loggerFactory ) { app . UseRouting ( ) ; app . UseAuthorization ( ) ; app . UseSwagger ( ) ; app . UseSwaggerUI ( c => { c . SwaggerEndpoint ( " " , " " ) ; } ) ; app . UseEndpoints ( endpoints => { endpoints . MapControllers ( ) ; } ) ; if ( env . IsDevelopment ( ) ) { app . UseDeveloperExceptionPage ( ) ; } else { app . UseExceptionHandler ( " " ) ; app . UseHsts ( ) ; } }
This method gets called by the runtime.
This method gets called by the runtime .
//TODO: Uncomment this if you need wwwroot folder // app.UseStaticFiles(); //TODO: Either use the SwaggerGen generated Swagger contract (generated from C# classes) //TODO: Or alternatively use the original Swagger contract that's included in the static files // c.SwaggerEndpoint("/swagger-original.json", "Swagger Petstore Original"); //TODO: Use Https Redirection // app.UseHttpsRedirection(); //TODO: Enable production exception handling (https://docs.microsoft.com/en-us/aspnet/core/fundamentals/error-handling)
app
IApplicationBuilder
None
env
IWebHostEnvironment
None
loggerFactory
ILoggerFactory
None