
Security News
Deno Goes the Way of the Dinosaur
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.
dumb-router
Advanced tools
Path -> Handler mapping and execution–that's it
var Router = require('dumb-router');
var router = Router(); //factory; do not use `new`
router.register('/cats', meow);
router.register('/dogs', woof);
function meow() {
alert('a cat is speaking');
return 'meow';
}
function woof() {
alert('a dog is speaking');
return 'woof';
}
alert(router.execute('/dogs')[0]); // => woof
router.register('/say/:words', say);
function say(path, params) {
console.log(params.words);
}
router.execute('/say/hello-world');
router.register('/users/:userId', setUser, function(router) {
router.register('/edit', showUserForm);
});
router.execute('/users/5/edit');
router.register('/food', null, function(router) {
router.register('/cookies', cookies);
router.register('/cakes', cakes);
});
When the router executes, it returns an array, with an entry for each route handler.
undefined is added for handlers that do not return anything.I lied about dumb-router only doing path -> handler mapping and execution.
Being able to validate routes is useful, and we can do it by exposing a bit of
the route matching logic.
router.register('/food' null, function(router) {
router.register('/gourmet', gourmetFood);
router.register('/fast', fastFood);
});
router.path('food') //throws error, no handler for "/food"
router.path('food', 'gourmet'); // => '/food/gourmet'
router.path('food', 'fast'); // => '/food/fast'
router.path('food', 'home-cooking'); //throws error, no route defined
Some context around the origin of this class:
We used this Router class as part of our base Flux Store class, where
each Store had an instance of a Router. We only used the Router to
provide a convenient DSL for mapping Store private functions (state
mutators) to paths. Then, all such Stores would handle "navigate"
Actions from the Dispatcher by delegating to the Router's execute
method.
This decentralized routing pattern, where each store defined its own response to navigation actions, arose because we wanted to avoid exposing means of mutating store state.
The "single monolithic router" pattern, common in other frameworks, requires that Stores expose some means of mutating their internal State.
Decentralized routing has some drawbacks: duplicated routes, and the need to be loose when matching routes. For example, if two stores have routers, and one store responds to "/users/" and another store responds to "/users/new", and both Stores need to invoke their handlers when navigating to "/users/new", the router has to consider "/users/new" a match for "/users".
FAQs
path -> handler mapping and execution–that's it
The npm package dumb-router receives a total of 0 weekly downloads. As such, dumb-router popularity was classified as not popular.
We found that dumb-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.

Security News
Anthropic’s free OSS Scanner uses Mythos and other Claude models to find open source vulnerabilities and send maintainers reports with proposed fixes.

Security News
On Front Lines’ Early Adopters: CISO podcast, Andrew Becherer shares lessons from Datadog, weighs the long-term costs of AI-built tools, and explains how founders can actually gain a CISO’s trust.