http-proxy-middleware 是一套 Node.js 代理中间件 for conNECt, Express 和 browser-sync。

安装

npm install --save-dev http-proxy-middleware

配置

var proxyMiddleware = require('http-proxy-middleware');
var proxy = proxyMiddleware('/api', {target: 'http://www.example.org'});
//                          \____/  \________________________________/
//                            |                     |
//                          context              options
// 'proxy' is now ready to be used in a server.

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务