Program.cs 605 B

1234567891011121314151617181920212223242526272829
  1. using MQTTServer.Controllers;
  2. var builder = WebApplication.CreateBuilder(args);
  3. // Add services to the container.
  4. builder.Services.AddControllers();
  5. // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
  6. builder.Services.AddEndpointsApiExplorer();
  7. builder.Services.AddSwaggerGen();
  8. var app = builder.Build();
  9. // Configure the HTTP request pipeline.
  10. if (app.Environment.IsDevelopment())
  11. {
  12. app.UseSwagger();
  13. app.UseSwaggerUI();
  14. }
  15. app.UseHttpsRedirection();
  16. app.UseAuthorization();
  17. app.MapControllers();
  18. MQTTSERVER.InitMQTTServerAsync().Wait();
  19. app.Run();