using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; using Microsoft.OpenApi.Models; using System.Text.Json.Serialization; using System.Text; using Cloud_Manager.Models.Interfaces; using Cloud_Manager; using Cloud_Manager.Services; using Cloud_Manager.Models.ServiceRepo; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddSignalR(); builder.Services.AddControllers().AddJsonOptions(x => x.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles); builder.Logging.ClearProviders(); builder.Logging.AddConsole(); builder.Services.AddEntityFrameworkMySql().AddDbContext(options => { options.UseMySql(builder.Configuration.GetConnectionString("Connection"), new MariaDbServerVersion(new Version())); }); builder.Services.AddSingleton(); builder.Services.AddDbContext(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); // 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(); builder.Services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() ); }); var app = builder.Build(); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "SecureSwagger v1")); app.UseHttpsRedirection(); app.UseCors("CorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); app.MapControllers(); app.Run();