How to use the express-validator.query function in express-validator

To help you get started, we’ve selected a few express-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sourcegraph / sourcegraph / lsif / src / server / middleware / validation.ts View on Github external
export const validateInt = (key: string): ValidationChain =>
    query(key)
        .isInt()
        .toInt()
github sourcegraph / sourcegraph / lsif / src / server / middleware / validation.ts View on Github external
export const validateOptionalString = (key: string): ValidationChain =>
    query(key)
        .optional()
        .customSanitizer(value => value || '')
github sourcegraph / sourcegraph / lsif / src / server / middleware / validation.ts View on Github external
export const validateOptionalInt = (key: string): ValidationChain =>
    query(key)
        .optional()
        .isInt()
        .toInt()
github shanhuiyang / TypeScript-MERN-Starter / server / routes / comment.ts View on Github external
],
    controllers.read
);
comment.route("/add").post(
    passport.authenticate("bearer", { session: false }),
    [
        check("content", "toast.comment.content_empty").not().isEmpty(),
        query("targetType", "toast.user.attack_alert").isIn(Object.values(PostType)),
        query("targetId", "toast.user.attack_alert").not().isEmpty(),
    ],
    controllers.add
);
comment.route("/rate").get(
    passport.authenticate("bearer", { session: false }),
    [
        query("id", "toast.user.attack_alert").not().isEmpty(),
        query("rating", "toast.user.attack_alert").isIn(["0", "1"]),
    ],
    controllers.like
);
comment.route("/remove/:id").get(
    passport.authenticate("bearer", { session: false }),
    controllers.remove
);

export default comment;