Bootstrap FreeKB - Sails - routes.js
Sails - routes.js

Updated:   |  Sails articles

This assumes you have issued the sails lift command to start your Sails app. By default, the routes.js file, which is typically located in your apps config directory, will contain something like this.

Notice in this example that requesting the / endpoint will return the view-homepage-or-redirect action (method) and requesting the /faq endpoint will return the view-feq action (method).

module.exports.routes = {
  'GET /':                   { action: 'view-homepage-or-redirect' },
  'GET /faq':                { action:   'view-faq' },

 

For example, when navigating to http://<ip address or hostname>:1337 (assuming your app is using port 1337), this requests the / endpoint, which then calls the view-homepage-or-redirect action. Something like this should be returned.

 

On the other hand, when navigating to http://<ip address or hostname>:1337/faq, this requests the /faq endpoint, which then calls the view-faq action. Something like this should be returned.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 909baa in the box below so that we can be sure you are a human.