You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WF-PmAPI/WF_EF_Api/WfApi/Program.cs

55 lines
1.3 KiB

using DTO;
using Shared;
using StubApi;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddScoped<IUserService<UserDTO>, UserService>();
// Add services to the container.
builder.Services.AddControllers();
builder.Services.AddOpenApiDocument(options => {
options.PostProcess = document =>
{
document.Info = new NSwag.OpenApiInfo
{
Version = "v1",
Title = "WtfAPI",
Description = "What The Fantasy Site API",
TermsOfService = "",
Contact = new NSwag.OpenApiContact
{
Name = "The PM Mobile What The Fantasy team",
Url = ""
},
License = new NSwag.OpenApiLicense
{
Name = "No license",
Url = "https://license.fr"
}
};
};
});
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseOpenApi(); // Active la documentation OpenAPI
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();