Added a `Worker` class as a hosted background service to log periodic messages. Updated `DigitalData.EmailProfiler.API.csproj` to include `UserSecretsId` for secure development storage and added `Microsoft.Extensions.Hosting` package. Replaced the `Controllers` folder reference with `Properties`. Updated `Program.cs` to register the `Worker` service, enable API exploration, and retain Swagger configuration.
27 lines
492 B
C#
27 lines
492 B
C#
using DigitalData.EmailProfiler.API;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
builder.Services.AddHostedService<Worker>();
|
|
|
|
builder.Services.AddControllers();
|
|
|
|
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();
|