var express = require('express')
var proxy = require('http-proxy-middleware')
var app = express()

app.use('/api', proxy({
   target: 'http://xxxxx', // 目标代理地址
   changeOrigin: true,
   pathRewrite: {
       '^/api': ''
   }  
}))

app.use(express.static('dist'))

app.get('*', function(req, res) {
    res.sendfile('./dist/index.html')
}) 

app.listen(8080, function(){
   do sth. 
})

 

相关文章:

  • 2021-12-07
  • 2022-12-23
  • 2021-04-19
  • 2021-06-12
  • 2022-01-21
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
猜你喜欢
  • 2021-07-30
  • 2022-12-23
  • 2021-05-07
  • 2021-05-12
  • 2021-08-01
  • 2021-05-16
相关资源
相似解决方案