roota
TypeScript icon, indicating that this package has built-in type declarations

1.7.0 • Public • Published

roota

npm version Build Status

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}`);
    });
});

Readme

Keywords

Package Sidebar

Install

npm i roota

Weekly Downloads

5

Version

1.7.0

License

MIT

Unpacked Size

21.6 kB

Total Files

36

Last publish

Collaborators

  • npmfish