Initialized the ASP.NET Core application in `Program.cs` with services for controllers, Swagger/OpenAPI, and middleware for HTTPS redirection and authorization. Added `launchSettings.json` to configure application launch profiles for HTTP, HTTPS, and IIS Express environments. Updated `ReC.API.csproj` to target .NET 8.0, enable nullable reference types, and include the `Swashbuckle.AspNetCore` package for Swagger support. Added `appsettings.json` and `appsettings.Development.json` for logging and environment-specific configurations. Reorganized the solution structure in `ReC.sln` by moving the `ReC.API` project under a `src` folder and updating the `NestedProjects` section.
26 lines
532 B
C#
26 lines
532 B
C#
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddControllers();
|
|
// 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.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|