2020-10-23 13:01:33 +00:00
|
|
|
|
using Elsa.Metadata;
|
|
|
|
|
|
using Elsa.Server.Api.Extensions;
|
2020-10-19 20:12:11 +00:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
|
|
namespace Microsoft.Extensions.DependencyInjection
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class ServiceCollectionExtensions
|
|
|
|
|
|
{
|
|
|
|
|
|
public static IServiceCollection AddElsaApiEndpoints(this IServiceCollection services)
|
|
|
|
|
|
{
|
2020-10-20 21:17:08 +00:00
|
|
|
|
services.AddControllers().AddJsonSerialization();
|
2020-10-19 20:12:11 +00:00
|
|
|
|
services.AddRouting(options => options.LowercaseUrls = true);
|
2020-10-23 13:01:33 +00:00
|
|
|
|
services.AddSingleton<IActivityDescriber, ActivityDescriber>();
|
2020-10-19 20:12:11 +00:00
|
|
|
|
|
|
|
|
|
|
services.AddApiVersioning(
|
|
|
|
|
|
options =>
|
|
|
|
|
|
{
|
|
|
|
|
|
options.ReportApiVersions = true;
|
|
|
|
|
|
options.DefaultApiVersion = ApiVersion.Default;
|
|
|
|
|
|
options.AssumeDefaultVersionWhenUnspecified = true;
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return services;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|