using Microsoft.EntityFrameworkCore; using WebApi.Context; using WebApi.Models; using WebApi.Repositories; using WebApi.RepositoryInterfaces; var builder = WebApplication.CreateBuilder(args); builder.Services.AddCors(options => { options.AddPolicy("AllowLocalhost3000", builder => builder .WithOrigins("http://localhost:5173", "https://localhost:5173", "http://192.168.1.138") // Include both HTTP and HTTPS origins .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials()); }); builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); builder.Services.AddDbContext(options => { options.UseSqlServer(builder.Configuration["JyrosContext"]); }); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } app.UseHttpsRedirection(); app.UseCors("AllowLocalhost3000"); app.UseAuthorization(); app.MapControllers(); app.Run(); public static class Globals { public static User curretUser = new User(); }