Optionally add a beoordeling while adding a verspakket
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using Cortex.Mediator;
|
||||
using Lutra.Application.Supermarkten;
|
||||
using Lutra.Application.Verspakketten;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Lutra.API.Controllers;
|
||||
|
||||
@@ -14,6 +14,22 @@ namespace Lutra.API
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowLocalDevelopment", policy =>
|
||||
policy.SetIsOriginAllowed(origin =>
|
||||
{
|
||||
if (!Uri.TryCreate(origin, UriKind.Absolute, out var uri))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return uri.Host is "localhost" or "127.0.0.1" or "[::1]";
|
||||
})
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod());
|
||||
});
|
||||
|
||||
builder.Services.AddCortexMediator(
|
||||
handlerAssemblyMarkerTypes: [typeof(Program), typeof(GetVerspakketten)],
|
||||
options => options.AddDefaultBehaviors()
|
||||
@@ -37,6 +53,8 @@ namespace Lutra.API
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseCors("AllowLocalDevelopment");
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user