finds.dev← search

// the find

express-validator/express-validator

★ 6,234 · TypeScript · MIT · updated Oct 2026

An express.js middleware for validator.js.

An Express middleware built on validator.js that lets you declare checks and sanitizers on the request body, query, params, headers and cookies inside route definitions, then collects the failures into one result. It suits Express apps that currently validate by hand in each handler and want that logic next to the route.

- One chain runs against several request locations, and wildcard paths like items.*.email work, so you aren't writing a separate validator per source.

- matchedData() returns only the fields that went through a validator or sanitizer. That's a cheap guard against mass assignment when you'd otherwise spread req.body into a model.

- oneOf and checkExact handle two cases most validation code leaves to hand-written conditionals: at least one of these fields must be present, and reject unknown keys.

- The source is split along the pipeline (chain builders, context items, context runners, one-of, schema, exact), and most modules have a spec file beside them, so the internals are readable without reverse-engineering one large file.

- The README is an install line and links. The real documentation lives on a separate site, and the repo carries a website/versioned_docs tree with copies of the docs for many releases, so the repo tells you very little about how to use it.

- Underneath it is validator.js, which expects strings. The library's coercion rules decide what a number, array or object looks like to a check, and the README doesn't explain them. You learn them from the docs site or from a failing test.

- The README still says Node.js 14 or newer. Node 14 has been end-of-life since 2023, so the stated support floor is out of date.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →