using API_SequentMicrosystems.Hubs; using API_SequentMicrosystems.Services; using Microsoft.OpenApi.Models; 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.AddSignalR(); 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); c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "SM_API", Description = "API of Measure and Control Device", Contact = new OpenApiContact { Name = "Jan Beníček", Email = "jan00@benicek.xyz" }, }); }); 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.MapHub("/signalr/sync"); app.MapControllers(); app.Run(); } } }