Can please someone let me know how to render all the views in the server and send it to the web browser ? Just like any other PHP framework would do ?
Is this feasible at all ?
Can please someone let me know how to render all the views in the server and send it to the web browser ? Just like any other PHP framework would do ?
Is this feasible at all ?
Read through the Sails.js documentation.
In the controllers section you can learn about the Response Object. On the response object you have a function called view()
.
So you can use res.view()
to render a view and send it to the client. Typical example:
functionNameHere: function(req, res, next) {
res.view({
data: {first: "one", second: "two"}
});
}
Sails.js is built on top of Express.js. There are already plenty of tutorials on how to use Express on the internet.
Here is the documentation for Express.
Just put:
YourFunctionName : function (req,res) {
res.view('yourview', option, data);
}
The parameters are optional depending on the way you need and you put your route.js file.
Read the controllers section on: http://sailsjs.org/#!documentation/controllers