Set up a new ASP.NET Core Web API project named `ReC.API` targeting .NET 8.0. - Added `ReC.sln` solution file with Debug and Release configurations. - Configured logging settings in `appsettings.json` and `appsettings.Development.json`. - Created `Program.cs` to bootstrap the application with controllers, Swagger, and middleware. - Defined project structure in `ReC.API.csproj`, including Swagger dependency and nullable reference types. - Added `launchSettings.json` with profiles for `http`, `https`, and `IIS Express`.
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();
|