Sails.js non-static routing urls

So I was working with this Sails.js flash message for user registration but then I got into a new issue. So basically I am using the following in the user controller to render non-static content of the user/register.js file to client.

'register': function(req, res){
    res.view();
},

This however means that the address to access the registration page will be http://localhost/user/register. Is it possible to change this url to work with http://localhost/register without webpage redirects (possibly from the above code itself)? This I believe can be handled using custom redirects Custom Routes. But using redirects could be ugly at times?

You linked to right documentation, but didn't look in the right section. You want to use the controller/action custom route syntax to route /register to the UserController.register action:

"/register": "UserController.register"

or

"/register": {controller: 'user', action: 'register'}

in your config/routes.js will do what you want.

To disable the default /user/register route, you can either 1) set actions to false in config/blueprints.js (this will turn off all default controller/action routing), or explicitly disable the route in config/routes.js:

"/user/register": {response: 'notFound'}