
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.
sails-controller-driven-routing
Advanced tools
A routing configuration similar to blueprint that reads the routes from the controller so everything is kept in one place
A routing configuration similar to blueprint that reads the routes from the controller so everything is kept in one place
It relies on blueprints validating your configuration (because I didn't want to copy/paste), but you could maybe disable blueprints entirely in production if you're feeling courageous and don't need any of its helpers.
n accessible pointsrouting.jsswitch() at the top of each exposed method.$ npm instal sails-controller-driven-routing
Your controller can now look like the following:
MyController.js
module.exports = {
_config: {
actions: false, //disable built in blueprints
shortcuts: false, //disable built in blueprints
rest: false, //disable built in blueprints
explicitRoutes: {
'OPTIONS /hello/world': 'mycontroller.world'
},
exposedMethods: [
'foobar'
]
},
world: function(res, req) {
return res.ok("hello");
},
foobar: function(res, req) {
return res.ok("bar");
},
foobarPost: function(res, req) {
return res.ok("par");
},
};
Now:
OPTIONS /hello/world will respond with hello
GET/POST/DELETE/OPTIONS/PUT/etc /mycontroller/foobar will respond with bar
POST /mycontroller/foobar will respond with par
You can also specify a prefix that'll work the same way as blueprints ones do which will override the 'mycontroller' segment of the url for the exposedMethods section.
Hopefully this will prove useful to someone else, pull requests welcome if you want to tidy it up a bit :)
FAQs
A routing configuration similar to blueprint that reads the routes from the controller so everything is kept in one place
The npm package sails-controller-driven-routing receives a total of 0 weekly downloads. As such, sails-controller-driven-routing popularity was classified as not popular.
We found that sails-controller-driven-routing 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 is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.