Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
2way-router
Advanced tools
routing plugin for node.js
var Router = require('2way-router');
var router = new Router();
// you must provide your own controllers
router.route('/')
.name('main')
.controller(mainPageController);
router.route('/news')
.name('news')
.controller(newsPageController);
router.route('/news/archive/{year ~ /\\d{4}/}-{month ~ /\\d{2}/}-{day ~ /\\d{2}/}/')
.name('news-archive')
.controller(newsArchiveController);
router.route('/news/{id:int}')
.name('news-publication')
.controller(newsPublicationsController);
router.findRoute('/news/archive/2014-06-21/').done(function (info) {
var controller = info.route.controller();
var params = info.params;
});
router.url('news-archive', {
year: 2014,
month: '06',
day: 21,
page: 3
}).done(function (url) {
// url === '/news/archive/2014-06-21/?page=3'
});
You will need to run
npm install 2way-router express
Example application:
var Router = require('2way-router');
var express = require('express');
var router = new Router();
function createPage(name, route) {
function pageController(req, res, params) {
res.send(200, 'page: ' + name + ' + params: ' + JSON.stringify(params));
}
router.route(route)
.name(name)
.controller(pageController);
}
createPage('main', '/');
createPage('news', '/news');
createPage('news-archive', '/news/archive/{year ~ /\\d{4}/}-{month ~ /\\d{2}/}-{day ~ /\\d{2}/}/');
createPage('news-publication', '/news/{id:int}');
var app = express();
app.use(function (req, res) {
try {
router.findRoute(req.path).done(function (info) {
info.route.controller()(req, res, info.params);
});
} catch(error) {
res.send(404, 'Not found');
}
});
app.listen(8080);
FAQs
2-way router
The npm package 2way-router receives a total of 23 weekly downloads. As such, 2way-router popularity was classified as not popular.
We found that 2way-router 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
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.