roota
v1.7.0
Published
Promise based routing
Downloads
30
Readme
roota
roota is a simple promise-based routing framework, influenced heavily by express.
const r = new Router();
r.use("/big/pot/:potNumber", req => {
return `Big Pot ${req.params.potNumber}`;
});
r.use("/small/cup/:cupNumber", req => {
return `Small Cup ${req.params.cupNumber}`;
});
r.handleRequest({ path: "/big/pot/1" }).then(value => {
console.log(`-- Value ${value}`);
}).then(() => {
return r.handleRequest({ path: "/small/cup/9" }).then(value => {
console.log(`-- Value: ${value}`);
});
});