From 6fa6b0a72c7dc924dc2bce59a09915caa8a5be63 Mon Sep 17 00:00:00 2001 From: Carlos Castro Date: Wed, 27 Nov 2024 15:05:58 +0000 Subject: [PATCH] enable swagger; --- rest_service/Program.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/rest_service/Program.cs b/rest_service/Program.cs index 9812b5e..d1e0e76 100644 --- a/rest_service/Program.cs +++ b/rest_service/Program.cs @@ -6,6 +6,7 @@ // Add services to the container. builder.Services.AddControllers(); + // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); @@ -14,20 +15,17 @@ builder.Services.AddCors(options => { - options.AddPolicy("NewPolicy", builder => - builder.AllowAnyOrigin() - .AllowAnyMethod() - .AllowAnyHeader()); + options.AddPolicy( + "NewPolicy", + builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader() + ); }); var app = builder.Build(); // Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(); -} +app.UseSwagger(); +app.UseSwaggerUI(); app.UseHttpsRedirection(); app.UseCors("NewPolicy"); @@ -38,4 +36,5 @@ // Register custom serializers BsonSerializer.RegisterSerializer(new RecordingPlayerSerializer()); BsonSerializer.RegisterSerializer(new RecordingEventSerializer()); -app.Run(); \ No newline at end of file +app.Run(); +