summary refs log tree commit diff
path: root/GitRepoViewer.CorsProxy/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'GitRepoViewer.CorsProxy/Program.cs')
-rw-r--r--GitRepoViewer.CorsProxy/Program.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/GitRepoViewer.CorsProxy/Program.cs b/GitRepoViewer.CorsProxy/Program.cs
new file mode 100644

index 0000000..10b061b --- /dev/null +++ b/GitRepoViewer.CorsProxy/Program.cs
@@ -0,0 +1,33 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); +builder.Services.AddCors(options => +{ + options.AddPolicy( + "Open", + builder => builder.AllowAnyOrigin().AllowAnyHeader()); +}); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseCors("Open"); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); \ No newline at end of file