forked from sanchezvem/PyroFetes
Modification d'une erreur 500 dans Warehouse
This commit is contained in:
@@ -4,40 +4,39 @@ using PyroFetes;
|
||||
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
//builder.Services
|
||||
// .AddAuthenticationJwtBearer(s => s.SigningKey = "Thesecretusedtosigntokens")
|
||||
// .AddAuthentication();
|
||||
|
||||
// Services
|
||||
builder.Services.AddCors(options =>
|
||||
options.AddDefaultPolicy(policyBuilder =>
|
||||
policyBuilder.WithOrigins("http://localhost:61021")
|
||||
policyBuilder
|
||||
.WithOrigins("http://localhost:4200") // mettre le port Angular exact
|
||||
.WithMethods("GET", "POST", "PUT", "PATCH", "DELETE")
|
||||
.AllowAnyHeader()
|
||||
)
|
||||
);
|
||||
//builder.Services.AddAuthorization();
|
||||
);
|
||||
|
||||
|
||||
builder.Services.AddFastEndpoints().SwaggerDocument(
|
||||
options =>
|
||||
{
|
||||
options.ShortSchemaNames = true;
|
||||
});
|
||||
builder.Services.AddFastEndpoints().SwaggerDocument(options =>
|
||||
{
|
||||
options.ShortSchemaNames = true;
|
||||
});
|
||||
|
||||
builder.Services.AddDbContext<PyroFetesDbContext>();
|
||||
|
||||
WebApplication app = builder.Build();
|
||||
// app.UseAuthorization()
|
||||
// .UseAuthentication();
|
||||
app.UseFastEndpoints(options =>
|
||||
{
|
||||
options.Endpoints.RoutePrefix = "API";
|
||||
options.Endpoints.ShortNames = true;
|
||||
}
|
||||
).UseSwaggerGen();
|
||||
|
||||
// Middleware
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
// CORS doit être avant les endpoints
|
||||
app.UseCors();
|
||||
|
||||
// FastEndpoints et Swagger
|
||||
app.UseFastEndpoints(options =>
|
||||
{
|
||||
options.Endpoints.RoutePrefix = "API";
|
||||
options.Endpoints.ShortNames = true;
|
||||
}).UseSwaggerGen();
|
||||
|
||||
// app.UseAuthorization();
|
||||
// app.UseAuthentication();
|
||||
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user