@caviar/roe-block
v4.0.2
Published
Caviar block for roe
Downloads
39
Readme
@caviar/roe-block
Caviar block for roe
Install
$ npm i @caviar/roe-block
Usage
In caviar.config.js
module.exports = {
server (appInfo, config) {
// change config
return config
},
router (app, apply) {
const {router} = app
router.get('/foo', controller)
apply(app)
}
}
Hooks
...builtInBlockHooks
See [Caviar Blocks]
serverConfig SyncHook
Triggered after roe config is generated and before using.
Callback parameters:
- serverConfig
object
the composed server configuration - caviarOptions ``
routerLoaded SyncHook
Triggered after router anchor has been applied.
Callback parameters:
- app
Koa
the roe application - caviarOptions
loaded SyncHook
Triggered after all components of the roe application has been loaded, including:
- middlewares
- controllers
- services
- plugins
Callback parameters:
- app
- caviarOptions
listening SyncHook
Triggered when the server is listened to a port
Callback parameters:
- port
number
the port the server listening to - caviarOptions