This is a very simple sails.js project created from command line "sails new my-project". After having created the project, I create a controller, again, using the client tool (sails create controller dispatcher). In the api/controllers folder a new controller is generated ( DispatcherController.js). In this controller I have a simple method that returns a Hello World
function dispatch(req,res){
res.send('hello world!');
}
Then I open the config/routes.js
and enter a custom route
get /test: 'DispatcherController.dispatch'
I start my project. It runs at localhost:1337. Everything works fine. Now from my browser a enter the custom route url:
http://localhost:1337/test
But I am redirected to the default 404 page. Sails could resolve this route. I am completely lost here. How can someone create a custom route pointing to a controller and access it?
routes.js
is in the format'get /test':'DispatcherController.dispatch'
right? I see you have single quotes missing. – MjZac