jellyfin/Jellyfin.Api/Extensions/ApiApplicationBuilderExtensions.cs

28 lines
994 B
C#
Raw Normal View History

2019-11-23 11:43:30 -07:00
using Microsoft.AspNetCore.Builder;
namespace Jellyfin.Api.Extensions
{
2019-11-23 12:31:17 -07:00
/// <summary>
/// Extensions for adding API specific functionality to the application pipeline.
/// </summary>
2019-11-23 11:43:30 -07:00
public static class ApiApplicationBuilderExtensions
{
2019-11-23 12:31:17 -07:00
/// <summary>
/// Adds swagger and swagger UI to the application pipeline.
/// </summary>
/// <param name="applicationBuilder">The application builder.</param>
/// <returns>The updated application builder.</returns>
2019-11-23 11:43:30 -07:00
public static IApplicationBuilder UseJellyfinApiSwagger(this IApplicationBuilder applicationBuilder)
{
applicationBuilder.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
return applicationBuilder.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Jellyfin API V1");
});
}
}
}