Rendering is the process of collecting data (if any) and loading related templates (or simply passing the results directly). Then apply the collected data to the related templates. The final output is sent to the user.
This concept is exactly the same for the client and server. In the client, when using Backbone.View, the render method is more like a regular method in which you can put your visualization in it. You can call it draw , this is completely normal. The basic concept of Backbone.View is that you get your data from somewhere (mainly from this.model ) and then load the related templates (from the DOM using $ ('# template-id'). Html () or using the text requirejs plugin to load templates using AJAX requests). Once you have the data and the template, you can use your own template engine and "make" the final output, and then add it to the DOM so that users can see it.
The server will probably do the same, and then send the final output so that the browser can "display" it. However, there are some minor differences. On the client side, you download your templates using ajax requests or from the DOM, on the server side you are likely to download your templates from the hard drive. As for the data, on the client side you get your data using ajax requests or the data is already embedded in the server response (built-in javascript objects). On the server side, you will receive your data from the database (or cache) or from third-party services
source share