
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
express-package-json
Advanced tools
express middleware to expose the contents of package.json to the view engine via res.locals
Simple express function to expose the contents
of a package.json
file to the view engine. This is useful for displaying
the software version on a web page without having to update the page every
time the version changes in package.json
.
npm install --save express-package-json
Parameters:
pathToPackageJson
- path to the package.json
file. String. Defaults to ./package.json
.propertyName
- name of property to add to res.locals
. String. Defaults to pkg
.Returns:
(req, res, next)
.res.locals[variableName]
is set to a JavaScript object containing the parsed package.json
.next()
is called when complete.app.js
:
"use strict";
var express = require('express');
var expressPackageJson = require('express-package-json');
var app = express();
app.set('view engine', 'hbs');
app.use(expressPackageJson(path.join(__dirname, 'package.json')));
app.get('/', function (req, res) {
res.render('index');
});
views/index.hbs
:
{{pkg.name}} v{{pkg.version}}
npm test
See LICENSE.md
FAQs
express middleware to expose the contents of package.json to the view engine via res.locals
The npm package express-package-json receives a total of 17 weekly downloads. As such, express-package-json popularity was classified as not popular.
We found that express-package-json 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.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.