Move appbuilder and service collection to Jellyfin.Server

This commit is contained in:
Claus Vium
2019-11-24 15:27:58 +01:00
parent 111b46599a
commit 27e3cf1558
12 changed files with 184 additions and 112 deletions

View File

@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Builder;
namespace Jellyfin.Server.Extensions
{
/// <summary>
/// Extensions for adding API specific functionality to the application pipeline.
/// </summary>
public static class ApiApplicationBuilderExtensions
{
/// <summary>
/// Adds swagger and swagger UI to the application pipeline.
/// </summary>
/// <param name="applicationBuilder">The application builder.</param>
/// <returns>The updated application builder.</returns>
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");
});
}
}
}