{"id":15894758,"url":"https://github.com/clayrisser/check-params","last_synced_at":"2026-05-10T02:55:25.693Z","repository":{"id":57197499,"uuid":"71860418","full_name":"clayrisser/check-params","owner":"clayrisser","description":"Validates url, body, and query parameters for express and sailsjs","archived":false,"fork":false,"pushed_at":"2023-07-07T06:05:58.000Z","size":690,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T19:08:26.115Z","etag":null,"topics":["express","expressjs","node","nodejs","params","sails","sailsjs","validation"],"latest_commit_sha":null,"homepage":"https://jamrizzi.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clayrisser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-25T04:47:35.000Z","updated_at":"2023-07-07T06:06:03.000Z","dependencies_parsed_at":"2024-10-28T04:10:24.958Z","dependency_job_id":null,"html_url":"https://github.com/clayrisser/check-params","commit_stats":null,"previous_names":["jamrizzi/check-params"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clayrisser%2Fcheck-params","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clayrisser%2Fcheck-params/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clayrisser%2Fcheck-params/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clayrisser%2Fcheck-params/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clayrisser","download_url":"https://codeload.github.com/clayrisser/check-params/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246866670,"owners_count":20846600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","expressjs","node","nodejs","params","sails","sailsjs","validation"],"created_at":"2024-10-06T08:41:34.877Z","updated_at":"2026-05-10T02:55:25.650Z","avatar_url":"https://github.com/clayrisser.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# check-params\n\n[![npm](https://img.shields.io/npm/v/check-params.svg?style=flat-square)](https://www.npmjs.com/package/check-params) [![npm](https://img.shields.io/npm/dt/check-params.svg?style=flat-square)](https://www.npmjs.com/package/check-params)\n\nValidates url, body, and query parameters for Express\n\nPlease \u0026#9733; this repo if you found it useful \u0026#9733; \u0026#9733; \u0026#9733;\n\n![](assets/check-params.png)\n\n\n## Features\n\n* Check body params\n* Check query params\n* Check url params\n\n\n## Installation\n\n```sh\n$ npm install --save check-params\n```\n\n\n## Dependencies\n\n* [Node](https://nodejs.org/)\n* [Express](https://expressjs.com/)\n\n\n## Usage\n\n```js\nvar checkParams = require('check-params');\n\nmodule.exports = {\n  exampleController: function(req, res)  {\n    checkParams(req, {\n      queryParams: [\n        'hello',\n        'foo'\n      ]\n    }).then(function() {\n      res.json({\n        message: 'Yaaaay, I have everything I need!!!'\n      });\n    }).catch(function(err) {\n      console.warn(err);\n      res.status(err.code).json({\n        message: err.message\n      });\n    });\n  }\n};\n```\n\nNow, if I enter the following url . . .\n```url\nhttp://myserver.com/example?hello=world\u0026foo=bar\n```\n. . . I get the following response.\n```json\n{\n  \"message\": \"Yaaaay, I have everything I need!!!\"\n}\n```\n\nHowever, if I enter the following url, without the query params . . .\n```url\nhttp://myserver.com/example\n```\n. . . I get the following response.\n```json\n{\n  \"message\": \"You are missing the query params 'hello', and 'foo'.\"\n}\n```\n\nIf you do not put in the required parameters, you will get a response asking for them.\n\n### More Details\n\nThe checkParams function recieves three properties. The last property, options, is optional.\n```js\ncheckParams(\n  req, // the request object\n  {\n    urlParams: [], // an array of required url params\n    bodyParams: [], // an array of required body params\n    queryParams: [] // an array of required query params\n  },\n  { // the options property is not required\n    distictChar: '\\'', // the default character to distinguish missing parameters in the error message \n    oxfordComma: true // whether to use oxford comma's when separating lists\n  } \n);\n```\n\nThe checkParams function always returns as a promise. It is also good to note, that the err response has\na property called code. This contains the suggested response status code.\n\n\n## Support\n\nSubmit an [issue](https://github.com/jamrizzi/check-params/issues/new)\n\n\n## Buy Me Coffee\n\nA ridiculous amount of coffee was consumed in the process of building this project.\n\n[Add some fuel](https://pay.jamrizzi.com/) if you'd like to keep me going!\n\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -m 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n\n## License\n\n[MIT License](https://github.com/jamrizzi/check-params/blob/master/LICENSE)\n\n[Jam Risser](https://jamrizzi.com) \u0026copy; 2017\n\n\n## Credits\n\n* [Jam Risser](https://jamrizzi.com) - Author\n\n\n## Changelog\n\n0.3.0 (2017-06-28)\n* Removed message response\n\n0.1.0 (2016-10-25)\n* Beta release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclayrisser%2Fcheck-params","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclayrisser%2Fcheck-params","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclayrisser%2Fcheck-params/lists"}