
Security News
Critical Security Vulnerability in React Server Components
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.
packing-urlrewrite
Advanced tools
一个用来做代理和转发URL的express中间件
npm install packing-urlrewrite --save-dev
import Express from 'express';
import urlrewrite from 'packing-urlrewrite';
const rules = {
// 1.用json模拟数据,标示符为 `require!`
'^/api/(.*)': 'require!/mock/api/$1.js',
// 2.同域转发
'^/$': '/index.html',
// 3.跨域转发
'^/test/(.*)': 'http://test.xxx.com/test/$1'
};
const app = new Express();
const options = { debug: true };
app.use(urlrewrite(rules));
// /mock/api/$1.js
export default (req, res) => {
// maybe get parameters from request
const data = {
name: 'Joe'
};
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(data));
};
import Express from 'express';
import urlrewrite from 'packing-urlrewrite';
const rules = {
// 用热发配置rulesHotFile
rulesHotFile: __dirname + '/rewriteRules.js'
};
const app = new Express();
app.use(urlrewrite(rules));
// rewriteRules.js
module.exports = {
// 1.用json模拟数据,标示符为 `require!`
'^/api/(.*)': 'require!/mock/api/$1.js',
// 2.同域转发
'^/$': '/index.html',
// 3.跨域转发
'^/test/(.*)': 'http://test.xxx.com/test/$1'
}
debug - {boolean} 是否输出转发信息,默认值:false
FAQs
>一个用来做代理和转发URL的express中间件
We found that packing-urlrewrite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.

Research
/Security News
We spotted a wave of auto-generated “elf-*” npm packages published every two minutes from new accounts, with simple malware variants and early takedowns underway.

Security News
TypeScript 6.0 will be the last JavaScript-based major release, as the project shifts to the TypeScript 7 native toolchain with major build speedups.