From 4821a9139e3765394996b246ed6d895fb2108bff Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Tue, 18 Nov 2025 10:51:29 +0100 Subject: [PATCH] fix cors in Program.cs --- .../.idea/data_source_mapping.xml | 6 ++++++ .idea/.idea.ApiEfCoreLibrary/.idea/queries/Query.sql | 0 .idea/.idea.ApiEfCoreLibrary/.idea/sqldialects.xml | 6 ++++++ ApiEfCoreLibrary/Program.cs | 11 ++++------- 4 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 .idea/.idea.ApiEfCoreLibrary/.idea/data_source_mapping.xml create mode 100644 .idea/.idea.ApiEfCoreLibrary/.idea/queries/Query.sql create mode 100644 .idea/.idea.ApiEfCoreLibrary/.idea/sqldialects.xml diff --git a/.idea/.idea.ApiEfCoreLibrary/.idea/data_source_mapping.xml b/.idea/.idea.ApiEfCoreLibrary/.idea/data_source_mapping.xml new file mode 100644 index 0000000..4236fb7 --- /dev/null +++ b/.idea/.idea.ApiEfCoreLibrary/.idea/data_source_mapping.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.ApiEfCoreLibrary/.idea/queries/Query.sql b/.idea/.idea.ApiEfCoreLibrary/.idea/queries/Query.sql new file mode 100644 index 0000000..e69de29 diff --git a/.idea/.idea.ApiEfCoreLibrary/.idea/sqldialects.xml b/.idea/.idea.ApiEfCoreLibrary/.idea/sqldialects.xml new file mode 100644 index 0000000..839f26f --- /dev/null +++ b/.idea/.idea.ApiEfCoreLibrary/.idea/sqldialects.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ApiEfCoreLibrary/Program.cs b/ApiEfCoreLibrary/Program.cs index c662c40..7ed7502 100644 --- a/ApiEfCoreLibrary/Program.cs +++ b/ApiEfCoreLibrary/Program.cs @@ -12,17 +12,14 @@ builder.Services .AddFastEndpoints() .AddCors(options => { - options.AddPolicy("AllowAll", policy => - { - policy.AllowAnyOrigin() - .AllowAnyMethod() - .AllowAnyHeader(); + options.AddDefaultPolicy( policy => + { + policy.AllowAnyOrigin(); }); }) .SwaggerDocument(options => { options.ShortSchemaNames = true; - }); // On ajoute ici la configuration de la base de données @@ -41,6 +38,6 @@ app//.UseAuthentication() app.UseHttpsRedirection(); -app.UseCors("AllowAll"); +app.UseCors(); app.Run(); \ No newline at end of file