kori
v1.0.0
Published
a sample router handle for function.
Downloads
11
Readme
Kori
a simple route parser;
what is kori?
The kori bustard (Ardeotis kori) is arguably the largest flying bird native to Africa.
how to use it?
const Kori = require('kori');
// or
import Kori from 'kori';
const kori = new Kori();
const controller = (ctx, ...args) => {
console.log({ctx, args});
};
kori.get('/app/a/b', controller)
.get('/app/*', controller)
.post('/app/user/{id}', controller);
kori.handle('https://test.com/app/a/b','GET', 1, 2, 3);
kori.handle('/app/c/b', 'get', 4);
kori.handle('https://test.com/app/user/123', 'POST');
support methods:
const methods = [
'get', 'post', 'put', 'head', 'delete',
'options', 'trace', 'copy', 'lock', 'mkcol',
'move', 'purge', 'propfind', 'proppatch', 'unlock',
'report', 'mkactivity', 'checkout', 'merge', 'm-search',
'notify', 'subscribe', 'unsubscribe', 'patch', 'search', 'connect',
];