项目作者: imcuttle

项目描述 :
A better http-proxy-middleware with hot update config and cli
高级语言: JavaScript
项目地址: git://github.com/imcuttle/hotproxy.git
创建时间: 2019-08-12T07:30:50Z
项目社区:https://github.com/imcuttle/hotproxy

开源协议:MIT License

下载


hotproxy

Build status
Test coverage
NPM version
NPM Downloads
Prettier
Conventional Commits

A better http-proxy-middleware with hot update config and cli

Installation

  1. npm install hotproxy
  2. # or use yarn
  3. yarn add hotproxy

Usage

Package

  1. const app = require('express')()
  2. const { hotProxy } = require('hotproxy')
  3. const middleware = hotProxy(
  4. '/path/to/configFile', // Assign configuration file, It will find up the closest file named `hotproxy.config.js` when not setting.
  5. {
  6. // common config
  7. logLevel: 'debug'
  8. }
  9. )
  10. app.use(middleware)
  11. // Or
  12. app.use('/context', middleware)

Cli

  1. npm i hotproxy -g
  2. echo "module.exports = {
  3. '/': {
  4. target: 'https://www.baidu.com',
  5. changeOrigin: true,
  6. logLevel: 'debug'
  7. }
  8. }
  9. " > hotproxy.config.js
  10. hotproxy
  11. hotproxy --help

Config

See http-proxy-middleware

Contributing

  • Fork it!
  • Create your new branch:
    git checkout -b feature-new or git checkout -b fix-which-bug
  • Start your magic work now
  • Make sure npm test passes
  • Commit your changes:
    git commit -am 'feat: some description (close #123)' or git commit -am 'fix: some description (fix #123)'
  • Push to the branch: git push
  • Submit a pull request :)

Authors

This library is written and maintained by imcuttle, moyuyc95@gmail.com.

License

MIT - imcuttle 🐟