Files
ContactsApp/Program.cs
2025-12-14 18:15:23 +03:00

32 lines
875 B
C#

using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Swagger;
namespace ContactsApp;
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
builder.Services.AddAuthorization();
builder.Services.AddSwaggerGen();
builder.Services.AddSingleton<IContactRepository, ContactRepository>();
var app = builder.Build();
// Configure the HTTP request pipeline.
// Çàïðîñ -> Êîìïó -> Ïî ïîðòó -> Ïðèëîæåíèå -> Kestrel -> (HttpContext) Middlewares -> Controller (mapping) -> AfterMethod -> Method -> BeforeMethod
app.UseAuthorization();
app.UseSwagger();
app.UseSwaggerUI();
app.MapControllers();
app.Run();
}
}