
Security News
/Research
npm Phishing Email Targets Developers with Typosquatted Domain
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.
Simple and structured application level JSON responses for Express. Based on JSend specification.
Simple and structured application level JSON responses for Express. Based on JSend specification (http://labs.omniti.com/labs/jsend).
npm install jsender
Setup the middleware in your Express app. Before any routes.
var express = require('express')
, jsender = require('jsender')
;
var app = express();
// ... (other middlewares)
app.use(jsender());
app.get('/', function (req, res){
res.success({
notice: 'Hello, World!'
});
});
// JSON Response
// {
// "status": "success",
// "data": {
// "notice": "Hello, World!"
// }
// }
JSender augments the node res
object with the following methods.
success(data)
function (req, res){
res.success({
notice: 'Hello, World!'
});
};
// JSON Response
// {
// "status": "success",
// "data": {
// "notice": "Hello, World!"
// }
// }
fail(data)
function (req, res){
res.fail({
name: 'Name is required.'
});
};
// JSON Response
// {
// "status": "fail",
// "data": {
// "name": "Name is required."
// }
// }
error(message, data, code)
function (req, res){
res.error('Server error.');
};
// JSON Response
// {
// "status": "error",
// "message": "Server error."
// }
jsend(err, data)
null
.function (req, res){
books.find()
.exec(res.jsend);
};
// same as
function (req, res){
books.find()
.exec(function (err, data){
if (err)
return res.jsend(err);
res.jsend(null, data);
});
};
FAQs
Simple and structured application level JSON responses for Express. Based on JSend specification.
The npm package jsender receives a total of 14 weekly downloads. As such, jsender popularity was classified as not popular.
We found that jsender 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
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.
Security News
Knip hits 500 releases with v5.62.0, refining TypeScript config detection and updating plugins as monthly npm downloads approach 12M.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.