
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.
larvitrouter
Advanced tools
Route an URL to a controller, template and/or a static file.
Auto resolves files like so:
This behaviour can be changed with customized options.
npm i larvitrouter
All options passed here are optional and the given ones are the default that will be used if they are omitted.
Paths are relative to application root as first priority. If nothing is found there, all modules will be tested as relative to this path to try to find a matching file. The modules are searched in the order given in package.json dependencies.
Simple, use default options:
const Router = require('larvitrouter'),
router = new Router();
Use custom options (the defaults are used in this example):
const LUtils = require('larvitutils');
const lUtils = new lUtils();
const Router = require('larvitrouter');
const router = new Router({
'basePath': process.cwd(),
'cacheMax': 1000
'paths': {
'controller': {
'path': 'controllers',
'exts': 'js'
},
'static': {
'path': 'public',
'exts': false // Match all
},
'template': {
'path': 'public/templates',
'exts': ['tmpl', 'tmp', 'ejs', 'pug']
}
},
'log': new lUtils.Log(),
'routes': [{
'regex': '^/$',
'controllerPath': 'default.js',
'templatePath': 'default.tmpl'
}]
});
const Router = require('larvitrouter');
const router = new Router();
const http = require('http');
http.createServer(function(req, res) {
router.resolve(req.url, function(err, result) {
if (err) throw err;
// A static file was found
if (result.staticFilename !== undefined) {
console.log('static path: ' + result.staticPath);
console.log('static full path: ' + result.staticFullPath);
}
// A controller was found
if (result.controllerPath) {
console.log('controller path: ' + result.controllerPath);
console.log('controller full path: ' + result.controllerFullPath);
}
// A template was found
if (result.templatePath) {
console.log('template path: ' + result.templatePath);
console.log('template full path: ' + result.templateFullPath);
}
res.end('Resolved stuff, see console output for details');
})
}).listen(8001);
FAQs
URL router
The npm package larvitrouter receives a total of 532 weekly downloads. As such, larvitrouter popularity was classified as not popular.
We found that larvitrouter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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.