Some Questions about Separation of Front and Rear Ends

  node.js, question

First of all, we put aside Taobao’s nodejs as the front and back end separation of the middle layer.
The front and rear ends are separated, and the front and rear ends communicate through JSON.
Then what file is the page (html, shtml, jsp, or other)
Then does the page jump forward or backward
If the front-end jumps, how to keep the session (how to bring the login status to the next page).

Simple answers one by one?

First of all, we set aside Taobao’s nodejs as the front and back end separation of the middle layer.

“Taobao’s nodejs”, what is italinode? This has nothing to do with the separation of the front and rear ends.

The front and rear ends are separated, and the front and rear ends communicate through JSON.

No problem, can be realized, is also a common strategy

Then what file is the page (html, shtml, jsp, or other)

Usually it ishtmlNow, think about it, the front and back ends have been separated, that is to say, in the face of the user’s request, there is no longer any docking with your whattomcat,express/koa/toaAfter waiting for the server, who will do the rendering for you? The answer is none. After the front and back ends are separated, the rendering work is taken to the front end (browser), and the browser can read the What?. It can only behtml.

Then does the page jump forward or backward

In fact, both the front end and the back end can be used. The front end is the simplest#Do route identifier, or advanced pointhtml5 mode(AngularJSInside’s name); The back end isnginxSuch as “gateway” service for routing forwarding. The specific method depends on your solution and your needs.

If the front-end jumps, how will the session be maintained (how will the login status be taken to the next page)

If only the front-end routing is done, the page will not be overloaded, and it is not easy to maintain the state. Is it possible to store a global variable? UselocalStorageIs it possible? UsecookieIs it possible? In fact, there are many ways, and ultimately it depends on your specific business scenario.