midori-hapi

0.1.0 • Public • Published

midori-hapi

Connect your midori app to hapi.

build status coverage license version downloads

Install:

npm install --save hapi midori midori-hapi

Usage:

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();

Readme

Keywords

none

Package Sidebar

Install

npm i midori-hapi

Weekly Downloads

1

Version

0.1.0

License

CC0-1.0

Last publish

Collaborators

  • izaakschroeder