Skip to content

bootstarted/midori-express

Repository files navigation

midori-express

Connect your midori app to express.

build status coverage license version downloads

Install:

npm install --save express midori midori-express

Usage:

import express from 'express';
import http from 'http';
import connector from 'midori-express';
import {request, get, send, header, compose} from 'midori';

// Create a midori app.
const basicApp = get('/test', compose(
  header('Content-Type', 'text/plain'),
  send('Hi from midori'),
));
const errorApp = get('/error', request(() => {
  const error = new Error();
  error.statusCode = 418;
  throw error;
}));
const createApp = compose(basicApp, errorApp);

// Create your express app.
const app = express();
// Connect your midori app to your express app.
app.use(connector(createApp));
// Use express as normal.
app.get('/', (req, res) => res.status(200).send('Hi from express.'));
// Start your server.
app.listen();

About

Connect your midori apps to express.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published