
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
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
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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.