Ask for help from the interview questions, how to separate the front and back ends in the project, and what is the specific implementation plan? And ssr rendering.

it is very common for an interview question. Although a large number of theoretical answers are found in the evening, I want to know how to separate the front and rear ends in practical projects

.

the concept of ssr server rendering has always been vague. What is the specific role in the project?


I think this kind of interview question is an open question. To be careful, there are too many things. If it is to investigate, it may be to see if there are some holes encountered in the actual work and the solutions. I will share some of the problems I have encountered and solutions:

  • the first point is to first consider whether the project needs front-end separation. If it is a heavy front-end type of project, such as a network disk, then front-end separation is really feasible. If it is a content-driven project like blog, do not need front-end separation. It is meaningless
  • The data format returned by the
  • API is often encountered that the data returned by the backend is not what the frontend expects. In this case, either the backend changes the interface or the frontend does data processing. In short, quarrels often occur, and there are many solutions, such as communicating in advance and designing a data format that everyone is satisfied with, doing middle-tier services (more complex projects), and trying some interface specifications with schema constraints. Such as json-restful or GraphQL and so on
  • the front-end separation I understand is only the logical separation of the code. In practice, it is still necessary to communicate more with the back-end and give feedback on some problems in the implementation of the project in time, because some problems may be solved at the front-end, while some problems may be better solved at the back-end. For example, for things like permissions, it is best not to authenticate at the front-end
  • .
  • caching, I think, is also a big hole in front-end separation, so let's not expand on this, it involves too many things
  • if SPA still wants to make some optimizations on SEO, give it back to the whole SSR

I will not talk nonsense about specific SSR rendering, because it is really a simple contact and has done some small DEMO projects, and there is no practical experience in real online projects.

the above personal humble opinion, if there are any mistakes, please correct them.


Front-end separation, that is, front-end pages can also be run separately from back-end services.
I'll talk briefly from the two parts of development and launch.

  • develop

Front-end development is no longer dependent on back-end services, just define the data structure and interface name.
for example, use restful mode: the front end uses mock, and the back end uses swagger.
so that the progress of the other end is not affected by one end. In addition, the back end can support web, mobile and third-party systems at the same time.

  • launch

the front and back end can be deployed independently, and the front-end files are no longer put into the back-end service. It can also better do some operation and maintenance operations such as load.

Let's talk about SSR, which means server-side renderings. Currently, you need to support SEO before you do SSR.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea00fc-47888.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea00fc-47888.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?