hapi-es7-async-handler
v1.0.11
Published
> async handler support for hapijs apps
Downloads
35
Readme
hapi-es7-async-handler
async handler support for hapijs apps
You can use this plugin to add async handler function to your hapi projects.
requiements
You need es7 supported javascript development environment or use Typescript
Usage
Example:
const server = new Hapi.server()
const plugins = [
...
{
register: require('hapi-es7-async-handler'),
},
...
];
server.register(plugins, (err) => {
...
})
server.route({
path: '/',
method: 'get',
handler: async (request, reply) => {
...
const result = await yourAsyncJob(); // the async job might be returning Promise object
reply(result);
}
});