2.0.0 • Published 6 years ago

swarfless v2.0.0

Weekly downloads
4
License
Unlicense
Repository
github
Last release
6 years ago

swarfless

A nano router for Zeit's micro

const micro = require('micro');
const Swarfless = require('swarfless');
const r = new Swarfless();


r.get('/', async () => 'Root of server');

// or
const { get, post } = r;

get('/hello/:name', async (req) => `Hi, ${req.params.name}`);
post('/set-name/:name', async (req) => `Setting name to ${req.params.name}`);

module.exports = r.get_route_handler();

Changes

Version 2 has changes to avoid storing the route in the module itself, which interferes with hot-reloading from micro-dev. Due to those changes, you must now create a Swarfless instance before using the route-building methods.

2.0.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago