{"id":20262909,"url":"https://github.com/swapnilsoni1999/express-dry","last_synced_at":"2025-04-11T02:07:43.281Z","repository":{"id":46624738,"uuid":"408427543","full_name":"SwapnilSoni1999/express-dry","owner":"SwapnilSoni1999","description":"Express.js Body, Query and Params validator based on https://github.com/uditkarode/drytype","archived":false,"fork":false,"pushed_at":"2021-10-28T18:17:03.000Z","size":166,"stargazers_count":12,"open_issues_count":4,"forks_count":14,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T02:07:33.995Z","etag":null,"topics":["express-middleware","express-validator","expressjs","hacktoberfest","hacktoberfest021"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwapnilSoni1999.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-20T12:07:02.000Z","updated_at":"2024-09-06T20:29:40.000Z","dependencies_parsed_at":"2022-09-23T02:22:31.693Z","dependency_job_id":null,"html_url":"https://github.com/SwapnilSoni1999/express-dry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwapnilSoni1999%2Fexpress-dry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwapnilSoni1999%2Fexpress-dry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwapnilSoni1999%2Fexpress-dry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwapnilSoni1999%2Fexpress-dry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwapnilSoni1999","download_url":"https://codeload.github.com/SwapnilSoni1999/express-dry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328162,"owners_count":21085261,"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-middleware","express-validator","expressjs","hacktoberfest","hacktoberfest021"],"created_at":"2024-11-14T11:32:29.867Z","updated_at":"2025-04-11T02:07:43.260Z","avatar_url":"https://github.com/SwapnilSoni1999.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express-Dry\nA simple lightweight [Express.js](https://expressjs.com) Validation Library (With predefined validators [WIP])\n\n## How to install\n- install from [npmjs](https://www.npmjs.com/package/express-dry)\n```\nnpm install express-dry\n```\nor\n```\nyarn add express-dry\n```\n\n- Include in your project\nEg. **routes/auth.js**\n```js\nconst { Router } = require('express')\nconst dry = require('express-dry')\n\nconst router = Router()\n\nrouter.post('/login', dry.body({\n  username: { type: String },\n  password: { type: String },\n  foo: { type: Boolean, required: false }\n}), async (req, res) =\u003e {})\n\nmodule.exports = router\n```\nAfter this the `.body` will return a middleware with packed automatic validation inside and it will directly return error response to client with a `{message: ''}` in it\n\n- Same with `params` and `query`\n\n```js\ndry.params({ id: { type: Number } }, { allowExtraKeys: false })\ndry.query({ search: { type: String, required: false } }, { allowExtraKeys: true, statusCode: 200 })\n```\n\n## Complete Example\n```js\nrouter.post('/login', dry.body({\n  name: { type: String },\n  age: { type: Number, min: 18, max: 35 },\n  password: { type: String, minLength: 8, maxLength: 20 },\n  consent: { type: Boolean, required: false }\n}, { allowExtraKeys: false }), async (req, res) =\u003e {})\n```\n\n## Features\n- All Javascript supported primitives\n- optional payload validation with `required: false`\n- Will be adding more custom validations such as Email, MongoObjectId and many more :)\n\n## Credits\n@uditkarode for [drytypes](https://www.npmjs.com/package/drytypes)\n\n### License\nMIT \u0026copy;Swapnil Soni\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswapnilsoni1999%2Fexpress-dry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswapnilsoni1999%2Fexpress-dry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswapnilsoni1999%2Fexpress-dry/lists"}