+1 vote
by
What does this array do in the router's post request?
router.post(
"/register",
[
check("email", "Некорректный email").isEmail(),
check("password", "Минимальная длина пароля 6 символов").isLength({ min: 6 })
],
() => { ... }
(Just a sample code) What is this array for? I didn't find this parameter in the docs, it only talked about path and callback parameters.
by
https://expressjs.com/en/4x/api.html#app.post.method

Callback functions; can be:

A middleware function.
A series of middleware functions (separated by commas).
An arrayof middleware functions.
A combination of all of the above.

2 Answers

0 votes
by
 
Best answer
After the first argument comes a sequence of midvars (any number of them). You have an array of midvars first, and then a normal midvar function.

It's described in the doc:
5f085274dfeb1738787333.png
+1 vote
by
Well, everything has already been answered, and so it's express-validator
https://express-validator.github.io/docs/validatio...
...