Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eseom/hapi-es7-async-handler
support es7 async enabled routing handler
https://github.com/eseom/hapi-es7-async-handler
async async-handler-support es7 hapi plugin typescript
Last synced: about 2 months ago
JSON representation
support es7 async enabled routing handler
- Host: GitHub
- URL: https://github.com/eseom/hapi-es7-async-handler
- Owner: eseom
- Created: 2017-02-16T04:33:55.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-10T13:20:18.000Z (almost 7 years ago)
- Last Synced: 2024-10-17T01:07:29.067Z (2 months ago)
- Topics: async, async-handler-support, es7, hapi, plugin, typescript
- Language: TypeScript
- Size: 19.5 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NOTE
Note: This library is no longer needed since hapi17. This feature has been included as standard since hapi 17. You can use this plugin up to version 16 hapijs.
See the link below.
https://github.com/hapijs/hapi/issues/3429# hapi-es7-async-handler
> async handler support for hapijs apps
[![npm version][npm-badge]][npm-url]
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:
```js
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);
}
});
```[npm-url]: https://www.npmjs.com/package/hapi-es7-async-handler
[npm-badge]: https://img.shields.io/npm/v/hapi-es7-async-handler.svg