In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what is the role of the node middle layer". In the daily operation, I believe that many people have doubts about the role of the node middle layer. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "what is the role of the node middle layer?" Next, please follow the editor to study!
The role of the middle layer of node is to separate functions and reduce the burden of the plate; when there are too many requests, you can assign the request for page rendering to another service, and only process the requests related to data, so that the front end pays more attention to the view layer and more data logic is processed in the node layer, avoiding the repetition of data verification at the front end while the back end is required to do verification.
Operating environment of this tutorial: windows10 system, nodejs version 12.19.0, Dell G3 computer.
What is the use of node middle layer
Advantages of using Node as the Web middle tier:
1. Separation of functions to lighten the burden on plates.
2. page data verification and logic code can be reused across systems and terminals, and there is no need to rewrite the check because of the access of the new system and terminal.
3. Data verification is done only once in the middleware, which avoids the repetition of data verification at the front end and the back end at the same time, which effectively ensures the validity of the data and reduces the overall workload of the team.
4. Processing data logic frees the front end to both render and write complex logic, making page developers focus on page rendering, which not only makes the division of labor clearer and the project collaboration more efficient, but also makes the page load faster and the user experience better, avoiding the unfriendly experience of browsers displaying blank pages for a long time.
The node middle tier can do the following:
Proxy: in the development environment, we can use the agent to solve the most common cross-domain problems; in the online environment, we can use the agent to forward requests to multiple servers.
Caching: caching is actually closer to the front-end requirements. The user's actions trigger data updates, and the node middle tier can directly deal with part of the caching requirements.
Current limiting: node intermediate layer, which can be used to respond to interfaces or routes.
Logging: compared with other server-side languages, node middle-tier logging can more easily and quickly locate the problem (whether it is on the browser side or the server side).
Monitoring: good at highly concurrent request processing, monitoring is also an appropriate option.
Authentication: there is an intermediate layer to authenticate, which is also the realization of a single responsibility.
Routing: the front end needs to master the permissions and logic of page routing.
Server rendering: node middle layer solutions are more flexible, such as SSR, template straight out, using some JS libraries for pre-rendering, and so on.
The role of node intermediate layer:
After the front end is also mvc,NodeJS, the front end can focus more on the view layer and let more data logic be processed in the Node layer.
When you find that all the requests are too much to cope with, you can consider doing such a separation, handing the request for page rendering to another service, blocking the front, and only responsible for the data-related requests. Nodejs is good at handling io-intensive tasks and is very suitable for page rendering services.
At this point, the study on "what is the role of the middle tier of node" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.