Commit dbd277d1 authored by poslovitch's avatar poslovitch
Browse files

Ajout d'un header CORS

parent b6aa7119
......@@ -22,6 +22,14 @@ $app = new \Slim\App(
//add middleware to add header for all routes
$app->add(function ($req, $res, $next) {
$response = $next($req, $res);
return $response
->withHeader('Access-Control-Allow-Origin', '*')
->withHeader('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type, Accept, Origin, Authorization')
->withHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, PATCH, OPTIONS');
$app->get('/', function (Request $request, Response $response, $args) {
$response->getBody()->write("Welcome in FooGood !");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment