CourseWork_EventVisitor/EventVisitor/EventVisitorRestApi/Program.cs

34 lines
872 B
C#
Raw Normal View History

2024-11-03 01:20:30 +04:00
using EventVisitorDatabase;
2024-11-03 10:18:08 +04:00
using EventVisitorDatabase.Implements;
using EventVisitorLogic.StoragesContracts;
2024-11-03 01:20:30 +04:00
using Microsoft.EntityFrameworkCore;
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();
2024-11-03 10:18:08 +04:00
builder.Services.AddTransient<IEventStorage, EventStorage>();
builder.Services.AddTransient<IVisitorStorage, VisitorStorage>();
builder.Services.AddTransient<IOrganizerStorage, OrganizerStorage>();
2024-11-03 01:20:30 +04:00
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();