//using CartriX.Api.Interfaces; //using CartriX.Api.Services; using Microsoft.EntityFrameworkCore; using Scalar.AspNetCore; using Microsoft.EntityFrameworkCore.Internal; using CartriX.Api; var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); //builder.Services.AddScoped(); //builder.Services.AddScoped(); //builder.Services.AddScoped(); //builder.Services.AddScoped(); //builder.Services.AddScoped(); //builder.Services.AddScoped(); //builder.Services.AddScoped(); //builder.Services.AddSingleton(); //builder.Services.AddHostedService(); builder.Services.AddCors(options => { options.AddPolicy("AllowAll", policy => { policy .AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod(); }); }); builder.WebHost.UseUrls( "http://0.0.0.0:5000" ); builder.Services.AddOpenApi(options => { options.AddDocumentTransformer((document, context, cancelationToken) => { document.Info = new() { Title = "CartriX API" }; return Task.CompletedTask; }); }); builder.Services.AddDbContext(options => { options.UseSqlite( builder.Configuration.GetConnectionString("DevSQL")); }); var app = builder.Build(); app.UseBlazorFrameworkFiles(); app.UseStaticFiles(); app.UseRouting(); app.UseCors("AllowAll"); app.MapControllers(); app.MapFallbackToFile("index.html"); if (app.Environment.IsDevelopment()) { app.MapOpenApi(); app.MapScalarApiReference(options => { options.HideSearch = true; options.HideModels = true; options.Layout = ScalarLayout.Modern; options.DefaultOpenAllTags = false; options.Agent = new ScalarAgentOptions { Disabled = true }; options.Title = "CartriX API Documentation"; options.Theme = ScalarTheme.DeepSpace; }); } app.Run();