koa-server-http-proxy:一种koa-http-proxy-中间件

时间:2024-02-24 08:41:05
【文件属性】:

文件名称:koa-server-http-proxy:一种koa-http-proxy-中间件

文件大小:12KB

文件格式:ZIP

更新时间:2024-02-24 08:41:05

koa koa-proxy koa-http-proxy koa-http-proxy-middleware KoaJavaScript

koa-server-http-proxy koa2 http-proxy-middleware。 安装 $ npm install koa-server-http-proxy --save 例 const Koa = require ( 'koa' ) const app = new Koa ( ) const proxy = require ( 'koa-server-http-proxy' ) app . use ( proxy ( '/api' , { target : 'https://news-at.zhihu.com' , pathRewrite : { '^/api' : 'api/4/' } , changeOrigin : true } ) ) app . listen ( 3000 ) 浏览器 http://127.0.0.1:3000/api/themes 例2 const Koa = require ( 'koa' ) const app = new Koa ( ) const proxy = require ( 'koa-server-htt


【文件预览】:
koa-server-http-proxy-master
----yarn.lock(30KB)
----README.md(1KB)
----exapmle()
--------index.html(219B)
--------app.js(807B)
----.editorconfig(41B)
----.gitignore(145B)
----_config.yml(25B)
----index.js(365B)
----package.json(869B)

网友评论