GGMM/GrossesMitaines/GrossesMitainesAPI/Program.cs

30 lines
717 B
C#
Raw Normal View History

2022-10-08 14:02:05 -04:00
using GrossesMitainesAPI.Data;
using Microsoft.EntityFrameworkCore;
2022-09-27 14:26:56 -04:00
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();
2022-10-08 14:02:05 -04:00
builder.Services.AddDbContextFactory<InventoryContext>(options => { options.UseSqlServer("DefaultConnection"); });
2022-09-27 14:26:56 -04:00
var app = builder.Build();
// Configure the HTTP request pipeline.
2022-10-08 14:02:05 -04:00
if (app.Environment.IsDevelopment()) {
2022-09-27 14:26:56 -04:00
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();