Skip to content

caviarjs/roe-block

Repository files navigation

Build Status Coverage

@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

License

MIT