Permalink
Browse files

added CORS support

  • Loading branch information...
hasib32 committed Mar 6, 2017
1 parent b3b8d54 commit 493e3779e399000812bf8b9b9325ed6b1fcb7cd1
Showing with 83 additions and 5 deletions.
  1. +7 −3 bootstrap/app.php
  2. +2 −1 composer.json
  3. +54 −1 composer.lock
  4. +20 −0 config/cors.php
View
@@ -48,6 +48,9 @@
App\Console\Kernel::class
);
// load cors configurations
$app->configure('cors');
/*
|--------------------------------------------------------------------------
| Register Middleware
@@ -59,9 +62,9 @@
|
*/
// $app->middleware([
// App\Http\Middleware\ExampleMiddleware::class
// ]);
$app->middleware([
\Barryvdh\Cors\HandleCors::class,
]);
$app->routeMiddleware([
'auth' => App\Http\Middleware\Authenticate::class,
@@ -84,6 +87,7 @@
$app->register(App\Providers\RepositoriesServiceProvider::class);
$app->register(Laravel\Passport\PassportServiceProvider::class);
$app->register(Dusterio\LumenPassport\PassportServiceProvider::class);
$app->register(Barryvdh\Cors\LumenServiceProvider::class);
/*
|--------------------------------------------------------------------------
View
@@ -10,7 +10,8 @@
"vlucas/phpdotenv": "~2.2",
"ramsey/uuid": "^3.5",
"league/fractal": "^0.15.0",
"dusterio/lumen-passport": "^0.1.9"
"dusterio/lumen-passport": "^0.1.9",
"barryvdh/laravel-cors": "^0.8.6"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -0,0 +1,20 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Laravel CORS
|--------------------------------------------------------------------------
|
| allowedOrigins, allowedHeaders and allowedMethods can be set to array('*')
| to accept any value.
|
*/
'supportsCredentials' => true,
'allowedOrigins' => ['*'],
'allowedHeaders' => ['*'],
'allowedMethods' => ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
'exposedHeaders' => [],
'maxAge' => 0,
'hosts' => [],
];

0 comments on commit 493e377

Please sign in to comment.