1.0.4 • Published 5 years ago

@cloudseat/micro-router v1.0.4

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

A smart router middleware for Zeit's Micro, but also works well with all standard http.IncomingMessage and http.ServerResponse objects.

Installation

npm install @cloudseat/micro-router

Usage

const { route, get, post, put, del } = require('@cloudseat/micro-router')

const hello = (req, res) => {
    res.end('hello')
}
const bye = (req, res) => {
    res.end('bye')
}

module.exports = route(
    get('/', hello),
    post('/:token', bye),
    // ...
)