Skip to content

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

License

Notifications You must be signed in to change notification settings

imcuttle/hotproxy

Repository files navigation

hotproxy

Build status Test coverage NPM version NPM Downloads Prettier Conventional Commits

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

Installation

npm install hotproxy
# or use yarn
yarn add hotproxy

Usage

Package

const app = require('express')()
const { hotProxy } = require('hotproxy')

const middleware = hotProxy(
  '/path/to/configFile', // Assign configuration file, It will find up the closest file named `hotproxy.config.js` when not setting.
  {
    // common config
    logLevel: 'debug'
  }
)

app.use(middleware)
// Or
app.use('/context', middleware)

Cli

npm i hotproxy -g
echo "module.exports = {
  '/': {
    target: 'https://www.baidu.com',
    changeOrigin: true,
    logLevel: 'debug'
  }
}
" > hotproxy.config.js
hotproxy

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 🐟

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published