Guest User

Untitled

a guest
Aug 25th, 2019
67
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. namespace ExtensionMethods
  2. {
  3.  
  4. public static class SwaggerConfigurationExtension
  5. {
  6.  
  7. public static void AddSwaggerConfig(IServiceCollection services)
  8. {
  9.  
  10. services.AddSwaggerGen(c =>
  11. {
  12. c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
  13. });
  14. }
  15.  
  16. public static void UseCustomSwaggerConfig(IApplicationBuilder app)
  17. {
  18.  
  19. // Enable middleware to serve generated Swagger as a JSON endpoint.
  20.  
  21. app.UseSwagger();
  22.  
  23. // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
  24.  
  25. // specifying the Swagger JSON endpoint.
  26.  
  27. app.UseSwaggerUI(c =>
  28.  
  29. {
  30. c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
  31. });
  32.  
  33. }
  34. }
  35. }
RAW Paste Data