Encapsulating HTTP requests
1.npm init -y
2.npm i
3. Native writing
4. Create the hoa.js file
5. The new index. Js
6. Run the node index.js command to output the result
The introduction of CTX
Structure of 1.
2. The new request. Js
3. The new response. Js
4. A new context. Js
Modify the inde. Js
Modify the Hoa. Js
6. Run the node index.js command to output the result
Introducing middleware
https://www.cnblogs.com/cckui/p/10991062.html
Structure of 1.
- How to combine the two uses
2. Synchronize Operation 1
3. Synchronize Operation 2
4. Synchronize operation 3
5. Asynchronous operation
6. Output the result
7. Modified index. Js
8. Modify the hoa. Js
9. Run the node index.js command to output the result
Use policy mode to create a routing middleware
1. The new router. Js
2. Modify the index. Js
3. Run the node index.js command to output the result