Thanks to for GitHub - odan/slim4-skeleton: A Slim 4 Skeleton. It’s useful for startup.
I found Middleware/CorsMiddleware.php, but I don’t know how to use it .
I add ’ $app->add(CorsMiddleware::class);’ to config/middleware.php , but it’s not work for me.
Is any idea for it?
Thank you.
config/middleware.php
return function (App $app) {
// Parse json, form data and xml
$app->addBodyParsingMiddleware();$app->add(ValidationExceptionMiddleware::class); $app->add(TwigMiddleware::class); $app->add(TranslatorMiddleware::class); $app->add(SessionMiddleware::class); $app->add(CorsMiddleware::class); $app->addRoutingMiddleware(); $app->add(BasePathMiddleware::class); $app->add(ErrorMiddleware::class); };