feat(*) initial commit
This commit is contained in:
46
start/kernel.js
Normal file
46
start/kernel.js
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict'
|
||||
|
||||
const Server = use('Server')
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Global middleware are executed on each http request only when the routes
|
||||
| match.
|
||||
|
|
||||
*/
|
||||
const globalMiddleware = [
|
||||
'Adonis/Middleware/BodyParser',
|
||||
'Adonis/Middleware/Cors',
|
||||
'Adonis/Middleware/Session',
|
||||
'Adonis/Middleware/Shield',
|
||||
'Adonis/Middleware/AuthInit'
|
||||
]
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Named Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Named middleware is key/value object to conditionally add middleware on
|
||||
| specific routes or group of routes.
|
||||
|
|
||||
| // define
|
||||
| {
|
||||
| auth: 'Adonis/Middleware/Auth'
|
||||
| }
|
||||
|
|
||||
| // use
|
||||
| Route.get().middleware('auth')
|
||||
|
|
||||
*/
|
||||
const namedMiddleware = {
|
||||
auth: 'Adonis/Middleware/Auth'
|
||||
}
|
||||
|
||||
Server
|
||||
.registerGlobal(globalMiddleware)
|
||||
.registerNamed(namedMiddleware)
|
||||
.use(['Adonis/Middleware/Static'])
|
||||
Reference in New Issue
Block a user