The main Grind
application class extends Node’s EventEmitter and publishes several events you can use to extend and inject functionality into a Grind app.
The boot
event is published during the boot process just after all providers have been booted.
The router:boot
event is published as part of the Router.boot()
process.
This event is a good time to register any Middleware Builders or body parsers as it’ll be called before any routes are actually registered.
The listen
event is right after an instance of http.Server is created, but before listen
is actually called on it.
The parameters passed to the listen
event are the Grind
application and the http.Server
instance.
This event is a great place to setup things like WebSockets which will require access to the underlying http.Server
instance.
The shutdown
event is published during application shutdown and is a good time to clean up database connections, file watchers, and any other ongoing processes.