Return 400 for validation errors without identifier and enable permissive CORS in Development
This commit is contained in:
+10
-3
@@ -5,14 +5,23 @@ using WebApi.Extensions;
|
||||
|
||||
var builder = WebApplication.CreateBuilder();
|
||||
|
||||
const string devCorsPolicy = "dev-cors";
|
||||
|
||||
builder.Services
|
||||
.AddApplicationServices(builder.Configuration)
|
||||
.AddObservability(builder.Configuration);
|
||||
|
||||
if (builder.Environment.IsDevelopment())
|
||||
{
|
||||
builder.Services.AddCors(options => options.AddPolicy(devCorsPolicy, policy =>
|
||||
policy.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()));
|
||||
}
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseCors(devCorsPolicy);
|
||||
app.MapOpenApi();
|
||||
app.MapScalarApiReference();
|
||||
}
|
||||
@@ -25,6 +34,4 @@ app
|
||||
.MapTrackEndpoints()
|
||||
.MapUserEndpoints();
|
||||
|
||||
app.Run();
|
||||
|
||||
public partial class Program { }
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user