Introduced a new .NET 8.0 web application project with a minimal API setup. Configured Swagger for API documentation and added a `Worker` class as a background service for periodic tasks. Added `launchSettings.json` to define development profiles for HTTP, HTTPS, and IIS Express. Configured logging levels in `appsettings.json` and `appsettings.Development.json`. Included `Swashbuckle.AspNetCore` package for Swagger integration and configured the HTTP request pipeline to support development and production environments.
28 lines
517 B
C#
28 lines
517 B
C#
using ECMJobRunner.WebCron;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddControllers();
|
|
builder.Services.AddHostedService<Worker>();
|
|
|
|
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();
|