express-validator: query-parameters with filter

Viewed 112

I have a query parameter which could be used as a filter, looking like this:

query1=test
or
query1[gt]=100
or
query1[gte]=101
....

How do I integrate this into express-validator? It should be possible to append the querystrings parameters with more optional filter functionallity.

Even this, which is by far the worst approche, is not working.

query('query1').isAlphanumeric().optional()
query('query1[gt]').isAlphanumeric().optional()

Is there a way to do so? I was thinking about a regex pattern, but as I know its not possible to match a regex against parameters, only against values.

0 Answers
Related