
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Express routing templates provides a simple micro-templating syntax for building strings from a template and a `request` object.
Express routing templates provides a simple micro-templating syntax for building strings from a template and a request
object.
$ npm install ert
var ert = require('ert');
var express = require('express');
var app = express();
app.get('/:package', function (req, res) {
res.redirect(ert(req, '/package/:package'));
});
app.listen(3000);
e.g.
ert(req, '/foo/bar/[req.parms.x || "default-x"]')
Code in squre brackets ([
and ]
) is evalutated as a JavaScript expression. It has req
available as an object. It also supports shortcuts, so you could write the above as:
ert(req, '/foo/bar/[:x || "default-x"]')
There are characters that are shortucts, the defaults of these are:
exports.shortcutMap = {
':': 'req.params',
'$': 'req.query',
'@': 'req.body'
};
These can be used directly like:
ert(req, '/foo/bar/:x')
which is equivallent to:
ert(req, '/foo/bar/[req.params && req.params["x"]]')
Transforms the string with req
and returns the resulting string. It caches the compiled function so should be pretty good for performance.
Compiles src
and returns a JavaScript expression as a string. This can be used to generate client side code with something like:
function client(name) {
return 'function name(req){return ' + ert.compile(src) + '}';
}
Compiles src
and returns a function which expects a single argument, request
.
MIT
FAQs
Express routing templates provides a simple micro-templating syntax for building strings from a template and a `request` object.
We found that ert 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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.