diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-05 03:25:53 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-05 03:25:53 +0200 |
commit | 51d820e22a4517dbb06d38a4f07f7c48522ef811 (patch) | |
tree | 4a7749cf77223dff2414fd4b73cb17df43d7449e /GitRepoViewer.CorsProxy/Program.cs | |
download | GitTools-master.tar.xz |
Diffstat (limited to 'GitRepoViewer.CorsProxy/Program.cs')
-rw-r--r-- | GitRepoViewer.CorsProxy/Program.cs | 33 |
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 |