53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using back.ServicesExtensions;
|
|
using healthchecks;
|
|
|
|
namespace back;
|
|
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.UseExtensions();
|
|
|
|
builder.Services.AddControllers();
|
|
|
|
builder.Services.AddHealthChecks(options => {
|
|
options.CacheDuration = TimeSpan.FromMinutes(30);
|
|
options.Timeout = TimeSpan.FromSeconds(5);
|
|
options.AssembliesToScan = [typeof(Program).Assembly];
|
|
}).DiscoverHealthChecks();
|
|
|
|
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
builder.Services.AddCors(options =>
|
|
{
|
|
options.AddPolicy("AllowAll",
|
|
builder => builder.AllowAnyOrigin()
|
|
.AllowAnyMethod()
|
|
.AllowAnyHeader());
|
|
});
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.UseCors("AllowAll");
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|
|
}
|
|
}
|