In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what is the concept of node forwarding". Interested friends may wish to take a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the concept of node retweeting"!
Node forwarding refers to the process that when users need to request data, they can send a request to the front-end. After receiving the request, the front-end server sends a request to the back-end server to receive data, and then forwards it to the user. Request forwarding is used to forward the request to the back-end, and the obtained data is returned to the front-end by node. Node can be understood as a transit station.
Operating environment of this tutorial: windows10 system, nodejs version 12.19.0, Dell G3 computer.
What is node forwarding
Define
When the user needs to request data, the user sends the request to the front-end server, and then the front-end server receives the request, sends the request to the back-end server to receive data, and then forwards it to the user.
The essence of node forwarding is the same as that of webpack devServer, except that node forwarding is generally implemented by itself, and webpack devServer is a defined configuration.
Cross-domain understanding of node forwarding becomes the realization of webpack devServer principle
First of all, we need to understand what request forwarding is. Generally speaking, when the front end requests data from the back end, it needs a link from the back end to the front end. The front end directly requests the data on the connection. Request forwarding uses node to forward the request to the back end, and the obtained data is returned to the front end by node. It is understood that node is like a transit station.
Introduction of express module
Express is a development framework based on node.js. You can use it to quickly build a fully functional website.
When introducing express, like other modules, create a package.json file first, and then npm install can use it
Simulate the back-end service with node
Suppose there are now two services: service An and Service B. here we simulate a back-end service with node and put data {"data": "8091"} on the service service.
At this point, switch to the parent folder of serverA.js in the terminal, enter the command node serverA.js, and service An is created.
Enter http://localhost:8091/ in the browser to see the data {"data": "8091"} we put on Service A.
At this point, I believe you have a deeper understanding of "what is the concept of node forwarding". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.