Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
express-router-map
Advanced tools
转换 express router 的写法
npm i express-router-map
const express = require('express');
const router = express.Router();
// 封装路由的书写方式
// 支持 use/get/post/put/delete
// 写法转变
router.get('/a', () => {});
router.get('/b', () => {});
router.get('/c', () => {});
routerMap.get({
'/a': () => {},
'/b': () => {},
'/c': () => {}
});
// 示例:
// 将 router 传入
const routerMap = new(require('express-router-map'))(router);
routerMap.use({
'/a': (req, res, next) => {req.testData = testStr; next();}
});
routerMap.get({
'/a/single': (req, res) => res.send(req.testData),
'/a/array': [
(req, res, next) => next(),
(req, res) => res.send(req.testData)
],
'/b': (req, res) => res.send(testStr)
});
const app = new express();
app.use(router);
app.listen(3000);
FAQs
router map
The npm package express-router-map receives a total of 1 weekly downloads. As such, express-router-map popularity was classified as not popular.
We found that express-router-map demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.