concept local in category sails

This is an excerpt from Manning's book Sails.js in Action.
This allows you to share the same layout, partials, and (to some degree) locals, across each of your different views. Currently, your videos.ejs view is served by an explicit route that simulates an unauthenticated state of a dummy user. And each of the other views has a corresponding custom route in brushfire/config/routes.js that simulates an authenticated state, similar to the following listing.
You’ve seen how Sails makes data available to views with variables called locals. In chapter 9, you’ll transition to setting locals in your controller actions. For now, just so you get to see some action, you’ll pass through stub data in your explicit route. In Sublime, open brushfire/config/routes.js, and add the following locals to the GET / route.
Here, you pass a static dictionary of a simulated user to the view via locals. Figure 8.14 illustrates the compiling process where locals passed in the route are injected into a view to produce your server-rendered view.
The route
triggers the view along with locals. You use template tags that will stringify the value of the me dictionary or insert null if the me local is empty
. The result of this compile is a server-rendered view that contains the me dictionary
. The me dictionary will inform the frontend whether the user who made the request is authenticated or unauthenticated. Let’s see this in action. Restart Sails using sails lift, and navigate your browser to localhost:1337. Your browser should look similar to figure 8.15.
triggers the view along with locals. You use template tags that will stringify the value of the me dictionary or insert null if the me local is empty
. The result of this compile is a server-rendered view that contains the me dictionary
. The me dictionary will inform the frontend whether the user who made the request is authenticated or unauthenticated. Let’s see this in action. Restart Sails using sails lift, and navigate your browser to localhost:1337. Your browser should look similar to