https://github.com/bootstarted/midori-hapi
Connect your midori app to Hapi.
https://github.com/bootstarted/midori-hapi
hapi midori
Last synced: 8 months ago
JSON representation
Connect your midori app to Hapi.
- Host: GitHub
- URL: https://github.com/bootstarted/midori-hapi
- Owner: bootstarted
- Created: 2017-10-12T00:49:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-12T01:06:40.000Z (over 8 years ago)
- Last Synced: 2025-04-05T21:05:13.536Z (10 months ago)
- Topics: hapi, midori
- Language: JavaScript
- Size: 53.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# midori-hapi
Connect your [midori] app to [hapi].





Install:
```sh
npm install --save hapi midori midori-hapi
```
Usage:
```javascript
import {Server} from 'hapi';
import connector from 'midori-hapi';
import {request, get, send, header, compose} from 'midori';
import Boom from 'boom';
// Create a midori app.
const basicApp = get('/test', compose(
header('Content-Type', 'text/plain'),
send('Test'),
));
const errorApp = get('/error', request(() => {
throw Boom.teapot();
}));
const createApp = compose(basicApp, errorApp);
// Create a Hapi server.
const server = new Server();
server.connection({host: 'localhost', port: 0, compression: false});
// Connect your midori app here.
server.ext(connector(createApp));
// Start up
server.start();
```
[midori]: https://github.com/metalabdesign/midori
[hapi]: https://hapijs.com/