mini-cup
v2.0.0-beta
Published
Easy to serve static web resources, Easy to proxy requests.
Maintainers
Readme
Cup
Easy to serve web resources, and proxy requests. You can make use of the Cup to mock Nginx for your web application sometimes.
Installation
$ npm install -g mini-cup
Or
$ yarn add -g mini-cupUsage
Run the server by the specified path
$ cup run <path> //The path is your indicated directoryRun the server by the specified path and port
$ cup run <path> -p <port>Run by cup.config.js config mode
Run the server by the custom configuration. There you can to initialize a cup.config.js file in the current working directory.
$ cup initAnd run the start command:
$ cup run -cThe example of cup.config.js
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
}
}
}Proxy
More usage of Proxy, please refer to http-proxy-middleware.
License
MIT
