http-proxy-middleware
When the front end communicates with the background and encounters cross-domain problems, we can solve the cross-domain problem by setting up an nginx proxy to modify the source of the request. However, in fact, we can also set up a proxy ourselves through the http-proxy-middleware of nodejs.
Start the agent
1 | var express = require('express'); |
Start background service
1 | //1. Import express |
Using PostMan to simulate requests
Http-proxy-middleware advanced properties
Other advanced usage can refer to this blog: