Easy to serve web resources, and proxy requests. You can use the Cup
to mock a web server like the Nginx
for your static resource sometimes.
$ npm install -g mini-cup
Or
$ yarn add -g mini-cup
$ cup run <path> //The path is your indicated directory
$ cup run <path> -p <port>
Run the server by the custom configuration. There you can initialize a cup.config.js
file in the current working directory.
$ cup init
And run the start command:
$ cup run -c
const base = './dist'
module.exports = {
name: 'example',
listen: 3000,
root: base,
location: {
'/api/task/get': `${base}/get.json`,
'/api/task/add': `${base}/add.json`
},
proxyTable: {
'/join': {
target: 'https://github.com',
changeOrigin: true
}
}
}
More usage of Proxy, please refer to http-proxy-middleware.
MIT