koa-server-http-proxy
A koa2 http-proxy-middleware.
Installation
$ npm install koa-server-http-proxy --save
Example
const Koa = const app = const proxy = app app
Browser
http://127.0.0.1:3000/api/themes
Example2
const Koa = const app = const proxy = const proxyTable = '/json': target: 'http://jsonplaceholder.typicode.com' pathRewrite: '^/json': '' changeOrigin: true '/api': target: 'https://news-at.zhihu.com' pathRewrite: '^/api': 'api/4/' changeOrigin: true Object app
Options
All options are passed to http-proxy-middleware
, except that if options is passed
as a string, it will normalized as options' target.
See http-proxy-middleware for full list of accepted options.
License
MIT