Skip to content
/ cup Public

Easy to serve web resources, Easy to proxy requests.

Notifications You must be signed in to change notification settings

wewoor/cup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cup

NPM downloads NPM version

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.

中文文档 | English

Installation

$ npm install -g mini-cup

Or

$ yarn add -g mini-cup

Usage

Run the server by the specified path

$ cup run <path> //The path is your indicated directory

Run 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 initialize a cup.config.js file in the current working directory.

$ cup init

And run the start command:

$ cup run -c

The 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