Gathering detailed insights and metrics for koa2-http-proxy-middleware
Gathering detailed insights and metrics for koa2-http-proxy-middleware
npm install koa2-http-proxy-middleware
Typescript
Module System
Node Version
NPM Version
68.8
Supply Chain
77.6
Quality
74.9
Maintenance
50
Vulnerability
99.6
License
JavaScript (100%)
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
1,116
Last Day
1
Last Week
1
Last Month
10
Last Year
103
MIT License
3 Stars
14 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Dec 19, 2021
Minified
Minified + Gzipped
Latest Version
1.0.1
Package Id
koa2-http-proxy-middleware@1.0.1
Unpacked Size
107.00 kB
Size
32.78 kB
File Count
12
NPM Version
5.5.1
Node Version
8.9.3
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-50%
1
Compared to previous week
Last Month
-44.4%
10
Compared to previous month
Last Year
-39.8%
103
Compared to previous year
1
7
koa2请求转发中间件
初始化中间件
1const Koa = require('koa') 2const app = new Koa() 3const PORT = 3000 4const koaBodyparser = require('koa-bodyparser') 5const httpProxy = require('koa2-http-proxy-middleware') 6 7// 因中间件中需要解析body中的参数,故先添加该中间件 8app.use(koaBodyparser()) 9// apiHost即是你要转发请求到后端的host,其他的参数可以参考axioshttps://github.com/axios/axios 10app.use(httpProxy({ 11 apiHost: 'xxx.yyy.com' 12})) 13 14app.listen(PORT, () => { 15 console.log(`app start at: ${PORT}`) 16})
转发请求
在你的路由controller中使用如下方法转发请求
1 2async pages (ctx, next) { 3 // 这里可以做一些请求之前需要处理的事情 4 const data = await ctx.httpProxy() 5 // 这里可以做一些请求之后需要处理的事情 6 ctx.body = data 7} 8 9
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/14 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
78 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-17
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More