@cloudseat/micro-router

A smart router middleware for ZEIT's Micro

Usage no npm install needed!

<script type="module">
  import cloudseatMicroRouter from 'https://cdn.skypack.dev/@cloudseat/micro-router';
</script>

README

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),
    // ...
)