2020
10-15
10-15
Node 使用express-http-proxy 做api网关的实现
拷贝代码备忘,filter过滤请求,proxyReqOptDecorator重写请求头,代码如下:varexpress=require('express');varproxy=require('express-http-proxy')varapp=express();app.all('*',function(req,res,next){res.header("Access-Control-Allow-Origin",req.headers.origin);res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");res.header("Access-Control-Allow-Credentials","true");...
继续阅读 >