http-proxy-middleware express代理中间件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/adley_app/article/details/88012944
const express = require('express')
const proxy = require('http-proxy-middleware')

const app = express()

app.use('/api', proxy({ target: 'https://www.baidu.com', changeOrigin: true }))
app.listen(9000)

// http://localhost:3000/api/foo/bar -> http://www.example.org/api/foo/bar

猜你喜欢

转载自blog.csdn.net/adley_app/article/details/88012944