
Product
Introducing Data Exports
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.
check-params
Advanced tools
Validates url, body, and query parameters for Express
Please ★ this repo if you found it useful ★ ★ ★
$ npm install --save check-params
var checkParams = require('check-params');
module.exports = {
exampleController: function(req, res) {
checkParams(req, {
queryParams: [
'hello',
'foo'
]
}).then(function() {
res.json({
message: 'Yaaaay, I have everything I need!!!'
});
}).catch(function(err) {
console.warn(err);
res.status(err.code).json({
message: err.message
});
});
}
};
Now, if I enter the following url . . .
http://myserver.com/example?hello=world&foo=bar
. . . I get the following response.
{
"message": "Yaaaay, I have everything I need!!!"
}
However, if I enter the following url, without the query params . . .
http://myserver.com/example
. . . I get the following response.
{
"message": "You are missing the query params 'hello', and 'foo'."
}
If you do not put in the required parameters, you will get a response asking for them.
The checkParams function recieves three properties. The last property, options, is optional.
checkParams(
req, // the request object
{
urlParams: [], // an array of required url params
bodyParams: [], // an array of required body params
queryParams: [] // an array of required query params
},
{ // the options property is not required
distictChar: '\'', // the default character to distinguish missing parameters in the error message
oxfordComma: true // whether to use oxford comma's when separating lists
}
);
The checkParams function always returns as a promise. It is also good to note, that the err response has a property called code. This contains the suggested response status code.
Submit an issue
A ridiculous amount of coffee was consumed in the process of building this project.
Add some fuel if you'd like to keep me going!
git checkout -b my-new-featuregit commit -m 'Add some feature'git push origin my-new-featureJam Risser © 2017
0.3.0 (2017-06-28)
0.1.0 (2016-10-25)
FAQs
Validates url, body, and query parameters for Express
The npm package check-params receives a total of 16 weekly downloads. As such, check-params popularity was classified as not popular.
We found that check-params 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
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.

Research
/Security News
Bitwarden CLI 2026.4.0 was compromised in the Checkmarx supply chain campaign after attackers abused a GitHub Action in Bitwarden’s CI/CD pipeline.

Research
/Security News
Docker and Socket have uncovered malicious Checkmarx KICS images and suspicious code extension releases in a broader supply chain compromise.