using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Serilog; using UbloxSC20.Data; var builder = WebApplication.CreateBuilder(args); Log.Logger = new LoggerConfiguration() .WriteTo.Console() .WriteTo.File("logs/log.txt", rollingInterval: RollingInterval.Day) .CreateLogger(); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("UbloxSC20Context") ?? throw new InvalidOperationException("Connection string 'UbloxSC20Context' not found."))); // 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(); var app = builder.Build(); app.UseSwagger(); app.UseSwaggerUI(); app.UseHttpsRedirection(); app.UseAuthorization(); app.MapControllers(); app.Run();