Current collected state Current
Observed since 20 Oct, 19:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
3h-router
A simple router.
A simple router lib.
const Router = require('3h-router'),
router = new Router({ basePath: __dirname });
// You can get default values via Router.defaultOptions.
router.defaultPages.unshift('my-default-page.html');
router.subRouters.unshift('my-sub-router.js');
router.on('before', url => {
console.log(`[before] ${url}`);
// If there's any `before` event handler, then
// the routing will pause here, so remember to
// call router.route to continue the routing.
// In addition, if you want to forward the
// request, then just pass the target url.
router.route(url);
}).on('result', result => {
console.log(`[result] ${result.code}`);
}).on('error', err => {
console.log('An error occurred!');
console.error(err);
}).start(88);
console.log('Server started on port 88!');
module.exports = router => {
const { response } = router;
response.writeHead(200, {
'Content-Type': 'text/html'
});
response.end('<h1>Generated by sub-router!</h1>');
};
Just read the declaration files in typings to learn the APIs.
Download counts and popularity will appear here as the collector receives them.
Declarations describe requirements; they are not a resolved dependency graph.
Source distribution
{
"integrity": "sha512-gESj4FwOw0epJIWO6N6TDZl1ORss3T/rHI0uEHXVgaDeDBPM/cANWqhznBdv8ozY6fbn5Hk1OlYGt+ZhFkga8A==",
"shasum": "5df8ebbb31dae0de39a4a0006468940665682715",
"tarball": "https://registry.npmjs.org/3h-router/-/3h-router-1.3.1.tgz",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEYCIQCR6+s2tJZBVM/3Jyp5QetnsRW7i5wtGRxthHma2lfmMgIhAOlvdbRVAcMaSWbx4xFtNd9O8iinAVlzXCH8m9grFm74"
}
]
}Observed since 20 Oct, 19:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:ac66a9368c888fdc17d1a881a804074526a07d4bbce4d274bc1300a9f2c0af23