fix cors in Program.cs

This commit is contained in:
2025-11-18 10:51:29 +01:00
parent a404ae6799
commit 4821a9139e
4 changed files with 16 additions and 7 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourcePerFileMappings">
<file url="file://$PROJECT_DIR$/.idea/.idea.ApiEfCoreLibrary/.idea/queries/Query.sql" value="afc9949f-8c13-4d86-8c8c-8a2edf026c4e" />
</component>
</project>

View File

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/.idea/.idea.ApiEfCoreLibrary/.idea/queries/Query.sql" dialect="TSQL" />
</component>
</project>

View File

@@ -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();