{"repo":"evanshortiss/express-joi-validation","free":true,"listed":false,"github":"https://github.com/evanshortiss/express-joi-validation","clone":"git clone https://github.com/evanshortiss/express-joi-validation.git","description":"validate express application inputs and parameters using joi","language":"JavaScript","stars":103,"topics":["express-validation","joi","typescript","middleware","express","express-middleware"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"express-joi-validation A middleware for validating express inputs using Joi schemas. Features include: TypeScript support. Specify the order in which request inputs are validated. Replaces the incoming req.body , req.query , etc and with the validated result Retains the original req.body inside a new property named req.originalBody . . The same applies for headers, query, and params using the original prefix, e.g req.originalQuery Chooses sensible default Joi options for headers, params, query, and body. Uses peerDependencies to get a Joi instance of your choosing instead of using a fixed version. Quick Links API Usage (JavaScript) Usage (TypeScript) Behaviours Joi Versioning Validation Ordering Error Handling Joi Options Custom Express Error Handler Install You need to install joi with this module since it relies on it in peerDependencies . Example A JavaScript and TypeScript example can be found in the example/ folder of this repository. Usage (JavaScript) Usage (TypeScript) For TypeScript a helper ValidatedRequest and ValidatedRequestWithRawInputsAndFields type is provided. This extends the express.Request type and allows you to pass a schema using generics to ensure type safety in your handler function. You can minimise some duplication by using joi-extract-type. NOTE: this does not work with Joi v16+ at the moment. See this issue. API Structure module (express-joi-validation) createValidator(config) query(options) body(options) headers(options) params(options) response(o","default_branch":null,"files":null,"tree":[],"storefront":"/r/evanshortiss","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/evanshortiss/express-joi-validation/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}