| | | 1 | | using Anichron.API.Endpoints; |
| | | 2 | | using Anichron.API.Infrastructure; |
| | | 3 | | using System.Text.Json.Serialization; |
| | | 4 | | |
| | | 5 | | namespace Anichron.API; |
| | | 6 | | |
| | | 7 | | /// <summary>The services of the API's HTTP surface: the host plumbing in <c>Infrastructure</c> plus what the endpoints |
| | | 8 | | public static class ApiServices |
| | | 9 | | { |
| | | 10 | | extension(IServiceCollection services) |
| | | 11 | | { |
| | | 12 | | public IServiceCollection AddApiSurface(IConfiguration configuration) |
| | 2 | 13 | | => services |
| | 2 | 14 | | .ConfigureHttpJsonOptions(options => options.SerializerOptions.NumberHandling = JsonNumberHandling.Stric |
| | 2 | 15 | | .AddOpenApi(options => options |
| | 2 | 16 | | .AddDocumentTransformer<ProblemCodeDocumentTransformer>() |
| | 2 | 17 | | .AddDocumentTransformer<EnumDocumentTransformer>()) |
| | 2 | 18 | | .AddApiProblems() |
| | 2 | 19 | | .AddDatabase(configuration) |
| | 2 | 20 | | .AddForwardedHeadersSupport(configuration) |
| | 2 | 21 | | .AddAuthServices(configuration) |
| | 2 | 22 | | .AddProxyEndpoints() |
| | 2 | 23 | | .AddWorkItemServices() |
| | 2 | 24 | | .AddAuthorizationPolicies() |
| | 2 | 25 | | .AddRateLimiting(configuration) |
| | 2 | 26 | | .AddCorsPolicy(configuration) |
| | 2 | 27 | | .AddApiHealthChecks() |
| | 2 | 28 | | .AddEndpointServices(); |
| | | 29 | | } |
| | | 30 | | } |