1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| 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. })
|