Created
July 10, 2020 21:50
-
-
Save ankitvijay/afd1a7d90ab9dd07c17de06ec5c1b3e7 to your computer and use it in GitHub Desktop.
Part 4 - Startup.cs - 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import Swashbuckle.AspNetCore.SwaggerGen | |
// Import Swashbuckle.AspNetCore.SwaggerUI | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddControllers().AddNewtonsoftJson(options => | |
{ | |
options.SerializerSettings.Converters.Add(new EnumerationJsonConverter()); | |
}); | |
services.AddSwaggerGen(options => | |
{ | |
options.SwaggerDoc("v1", new OpenApiInfo {Title = "Enumeration NSwagger Sample", Version = "v1"}); | |
}); | |
} | |
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); | |
app.UseSwagger(); | |
app.UseSwaggerUI(options => | |
{ | |
options.SwaggerEndpoint("v1/swagger.json", "Enumeration NSwagger Sample"); | |
}); | |
} | |
app.UseHttpsRedirection(); | |
app.UseRouting(); | |
app.UseAuthorization(); | |
app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment