fix(kernel): add cors as server middleware
This commit is contained in:
parent
f21bb01a6b
commit
22f43b4012
|
@ -13,7 +13,6 @@ const Server = use('Server')
|
|||
*/
|
||||
const globalMiddleware = [
|
||||
'Adonis/Middleware/BodyParser',
|
||||
'Adonis/Middleware/Cors',
|
||||
'Adonis/Middleware/Session',
|
||||
'Adonis/Middleware/Shield',
|
||||
'Adonis/Middleware/AuthInit'
|
||||
|
@ -40,7 +39,22 @@ const namedMiddleware = {
|
|||
auth: 'Adonis/Middleware/Auth'
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Server Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Server levl middleware are executed even when route for a given URL is
|
||||
| not registered. Features like `static assets` and `cors` needs better
|
||||
| control over request lifecycle.
|
||||
|
|
||||
*/
|
||||
const serverMiddleware = [
|
||||
'Adonis/Middleware/Static',
|
||||
'Adonis/Middleware/Cors'
|
||||
]
|
||||
|
||||
Server
|
||||
.registerGlobal(globalMiddleware)
|
||||
.registerNamed(namedMiddleware)
|
||||
.use(['Adonis/Middleware/Static'])
|
||||
.use(serverMiddleware)
|
||||
|
|
Loading…
Reference in New Issue
Block a user