composer require leafs/cors
<?php require __DIR__ . '/vendor/autoload.php'; db()->connect( 'localhost', 'len', 'len', 'titok', 'mysql' ); app()->cors(); require 'app/routes/api.php'; app()->run();
app()->cors([ 'origin' => 'http://example.com', 'optionsSuccessStatus' => 200 ]);
Alapbeállítások:
{ "origin": "*", "methods": "GET,HEAD,PUT,PATCH,POST,DELETE", "allowedHeaders": "*", "exposedHeaders": "", "credentials": false, "maxAge": null, "preflightContinue": false, "optionsSuccessStatus": 204, }