From 51d820e22a4517dbb06d38a4f07f7c48522ef811 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 5 Jun 2023 03:25:53 +0200 Subject: Initial commit --- GitRepoViewer.CorsProxy/Program.cs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 GitRepoViewer.CorsProxy/Program.cs (limited to 'GitRepoViewer.CorsProxy/Program.cs') 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 -- cgit 1.5.1