summary refs log tree commit diff
path: root/GitRepoViewer.CorsProxy/Program.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-05 03:25:53 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-05 03:25:53 +0200
commit51d820e22a4517dbb06d38a4f07f7c48522ef811 (patch)
tree4a7749cf77223dff2414fd4b73cb17df43d7449e /GitRepoViewer.CorsProxy/Program.cs
downloadGitTools-master.tar.xz
Initial commit HEAD master
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