route-now

Express inspired ultra fast and minimalist router for serverless functions. Uses trouter and qs

Usage no npm install needed!

<script type="module">
  import routeNow from 'https://cdn.skypack.dev/route-now';
</script>

README

Express inspired ultra fast and minimalist router for serverless functions. Uses trouter and qs

Note: The api is still in flux. I would not use this library yet.

    const Router = require('route-now')
    const app = Router()
    app.use(authenticate)
    app.get('/', handle)
    app.post('/', handle)
    app.put('/', handle)
    app.delete('/', handle)

    module.exports = app.handler

    function authenticate(req, res) {
        if (!auth) throw({statusCode: 401})
    }

    function handle(req, res) {
        res.json({foo: 'bar'})
    }