
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
A node.js directory-driven router for connect/express.
It does not use the router functionality of connect/express. The new version of connect(3.x)/express(4.x) should be compatible.
var drouter = require("drouter"),
express = require("express"),
app = express(); // connect();
drouter("directory_root", app, "some user defined data object");
// return a list of path and middleware pairs
// [{pt:"loaded path", mw:"loaded module"}, ...].
// at this point, app has all the middleware loaded at their path
// using "app.use(path, middlewareCreator(userData))"
Suppose we have a directory structure as follow:
+mw1
index.js
+abc
index.js
+def
index.js
+fgh
+ hij
index.js
+ijk
+ghi
+efg
+bcd
index.js
+cde
Each index.js file exports a function which takes in a user defined data object and returns a connect/express compatible middleware.
drouter("mw1", app, {msg:"some msg"}) will load the app at these paths :
/mw1
/mw1/abc
/mw1/abc/def
/mw1/bcd
The index.js under hij will not be loaded because its parent directory fgh is not loadable and thus all its children are ignored.
Loadable condititon is applied by require.resolve("module").
Suggestion and help are always welcome !
MIT
FAQs
A node.js directory-driven router for connect/express
We found that drouter 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.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.