Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wewoor/cup
Easy to serve web resources, Easy to proxy requests.
https://github.com/wewoor/cup
cli expressjs nginx node proxy server
Last synced: 3 months ago
JSON representation
Easy to serve web resources, Easy to proxy requests.
- Host: GitHub
- URL: https://github.com/wewoor/cup
- Owner: wewoor
- Created: 2016-10-10T04:01:50.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-06-16T11:12:09.000Z (over 2 years ago)
- Last Synced: 2024-09-13T05:17:13.572Z (4 months ago)
- Topics: cli, expressjs, nginx, node, proxy, server
- Language: JavaScript
- Homepage:
- Size: 126 KB
- Stars: 6
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Cup
[![NPM downloads][download-img]][download-url] [![NPM version][npm-version]][npm-version-url]
**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.
[download-img]: https://img.shields.io/npm/dm/mini-cup.svg?style=flat
[download-url]: https://www.npmjs.com/package/mini-cup
[npm-version]: https://img.shields.io/npm/v/mini-cup.svg?style=flat-square
[npm-version-url]: https://www.npmjs.com/package/@dtinsight/molecule[中文文档](./README_zh.md) | [English](./README.md)
## Installation
```bash
$ npm install -g mini-cupOr
$ yarn add -g mini-cup
```## Usage
### Run the server by the specified path
```bash
$ cup run //The path is your indicated directory
```### Run the server by the specified path and port
```bash
$ cup run -p
```### 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.
```bash
$ cup init
```And run the start command:
```bash
$ cup run -c
```#### The example of `cup.config.js`
```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](https://github.com/chimurai/http-proxy-middleware).
## License
MIT