Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ExtensionMethods
- {
- public static class SwaggerConfigurationExtension
- {
- public static void AddSwaggerConfig(IServiceCollection services)
- {
- services.AddSwaggerGen(c =>
- {
- c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
- });
- }
- public static void UseCustomSwaggerConfig(IApplicationBuilder app)
- {
- // Enable middleware to serve generated Swagger as a JSON endpoint.
- app.UseSwagger();
- // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
- // specifying the Swagger JSON endpoint.
- app.UseSwaggerUI(c =>
- {
- c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement