2
0

ApiApplicationBuilderExtensions.cs 997 B

123456789101112131415161718192021222324252627
  1. using Microsoft.AspNetCore.Builder;
  2. namespace Jellyfin.Server.Extensions
  3. {
  4. /// <summary>
  5. /// Extensions for adding API specific functionality to the application pipeline.
  6. /// </summary>
  7. public static class ApiApplicationBuilderExtensions
  8. {
  9. /// <summary>
  10. /// Adds swagger and swagger UI to the application pipeline.
  11. /// </summary>
  12. /// <param name="applicationBuilder">The application builder.</param>
  13. /// <returns>The updated application builder.</returns>
  14. public static IApplicationBuilder UseJellyfinApiSwagger(this IApplicationBuilder applicationBuilder)
  15. {
  16. applicationBuilder.UseSwagger();
  17. // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
  18. // specifying the Swagger JSON endpoint.
  19. return applicationBuilder.UseSwaggerUI(c =>
  20. {
  21. c.SwaggerEndpoint("/swagger/v1/swagger.json", "Jellyfin API V1");
  22. });
  23. }
  24. }
  25. }