From d5b3859e8677d44a8d4719abcbd8d4e7e08fc279 Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Fri, 26 Jan 2024 19:32:10 +0300 Subject: [PATCH] feat: add a CORS configuration --- Endpoint/Program.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Endpoint/Program.cs b/Endpoint/Program.cs index b0b9817..a9156f9 100644 --- a/Endpoint/Program.cs +++ b/Endpoint/Program.cs @@ -30,9 +30,17 @@ public class Program builder.Configuration.AddJsonFile(Settings.FilePath, optional: true, reloadOnChange: true); // Add services to the container. - builder.Services.AddControllers(); - // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle + + builder.Services.AddCors(options => + { + options.AddPolicy("AllowAll", policy => + { + policy.AllowAnyHeader(); + policy.AllowAnyMethod(); + policy.AllowAnyOrigin(); + }); + }); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen();