using API_SequentMicrosystems.Services; using System.Reflection; using System.Text.Json; using System.Text.Json.Serialization; namespace API_SequentMicrosystems { public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllers().AddNewtonsoftJson(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(c => { var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath); }); var app = builder.Build(); // Configure the HTTP request pipeline. if (true)//app.Environment.IsDevelopment()) { app.UseSwagger(c => { c.RouteTemplate = "api/{documentName}/swagger.json"; }); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/api/v1/swagger.json", "V1"); c.RoutePrefix = "api"; }); } app.UseAuthorization(); app.Services.GetService(); app.Services.GetService(); app.MapControllers(); app.Run(); } } }