Question

In many web frameworks (I am familiar with the Yii php framework) you are able to use some application component to create urls you can then use in various places in your application. You can usually give it a controller/action or some other combination of parameters and it will return a url eg. http://mydomain.com/index.php/<controllername>/<actionname>

The main thing you gain is that the application takes care of building urls and you aren't left ever hard coding url paths around the place.

My question is, does anyone know if the node sails js framework has such a thing or, if not, perhaps someone has written a module on npm that achieves this nicely?

Was it helpful?

Solution

Sails uses blueprints that do things similar to what you want. They provide a few different blueprints, for common things like CRUD or REST but they also have "Action Blueprints"

If you have a controller foo (FooController.js) that has action bar, it will be automatically accessible via /foo/bar when action blueprints are enabled (they are enabled by default)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top