
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
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 28 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
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.