var express = require('express');
const proxy = require('http-proxy-middleware');
const app = express();          
var options = {
        target: 'http://192.9.104.247:7894',    //  你服务器端口
        changeOrigin: true,
    };
var exampleProxy = proxy(options);
app.use(express.static('./'));//静态资源
app.use('^/', exampleProxy);              //  ‘/’ 表示对所有请求代理
app.listen(5000,"192.9.104.116");// 你NodeJs代理端口 与本地服务ip

启动服务为:

192.9.104.116:5000

node ./app.js 启动代理监听5000服务返回静态资源,接口请求就转发到
http://192.9.104.247:7894这个服务

相关文章:

  • 2021-12-11
  • 2021-06-15
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2022-02-04
  • 2021-12-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案