hapi-generoutify
Wraps route's handlers into generator
Installation
npm install hapi-generoutify --save
Usage
You can use hapi-generoutify for generator router's handlers (and the yield
keyword), and co today.
Registering the Plugin
const Hapi = ;const hapiGeneroutify = ; const server = ;server;
Now all route's handler will be wrap to co.wrap
.
{ const user = databaseUser; if !user Promise; ;} server;
Also you can pass just simple function to handler and it will work as before.
By default your generator are catched by global errorHandler, which reply error. You can define custom handler as hapi server method like:
server;
See full examples in examples folder.