Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
express-json-mask
Advanced tools
Express middleware for filtering the JSON responses
#Installation npm install --save express-json-mask
#Usage
var express = require('express'),
expressJsonMask = require('express-json-mask'),
app = express();
var json = {
name: 'Express',
version: 'version',
description: 'description',
repository: {
type: 'git',
url: 'url'
}
};
app.use(expressJsonMask(/*[optional] query parameter to use (defaults to fields)*/));
// example: app.use(expressJsonMask('field'));
app.get('/', function(request, response) {
response.status(200).json(json/*, [optional] filtering target*/);
// example: xxx.json(json, 'repository');
// curl: http://localhost:1337/?fields=type
// response: {
// name: 'Express',
// version: 'version',
// description: 'description',
// repository: {
// type: 'git',
// }
// }
// -------------------------------------------
// example: xxx.json(json);
// curl: http://localhost:1337/?fields=type
// -- the filter does not match any fields in the root of the json
// response: {
// name: 'Express',
// version: 'version',
// description: 'description',
// repository: {
// type: 'git',
// url: 'url'
// }
// }
// -------------------------------------------
// example: xxx.json(json);
// curl: http://localhost:1337/?fields=name,version,repository(url)
// response: {
// name: 'Express',
// version: 'version',
// repository: {
// url: 'url'
// }
// }
});
app.listen(1337);
#Syntax Look at the awesome module Json-Mask for the available syntax
FAQs
Express middleware for filtering the json responses
The npm package express-json-mask receives a total of 0 weekly downloads. As such, express-json-mask popularity was classified as not popular.
We found that express-json-mask 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.