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-wqnRBXYBsWiDbmHlf5b5iUh8xMkotcP1bgvY0hGslZPgExLQlKWiSB90/OaUa+LnHCKslnP8ZPHvZNLUQOVPUw==",
"shasum": "894b16db47ad117327d2c0d57b9edd4286b9b63c",
"tarball": "https://registry.npmjs.org/3h-router/-/3h-router-1.4.1.tgz",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEYCIQCdX7zjOg9gvzzwKW93B8u85R0QzDoPYBkeLP4mjJlVDwIhAOJwleJByFI0u9B+7ujKf7J9bOn7q4rNGQ6P1cAhIPnD"
}
]
}Observed since 20 Oct, 19:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:22eeb16fd55bc73c3af84a304c00aa8cd79367f6911c6a68211a486c020a6550