setting up stuff

This commit is contained in:
2022-07-12 21:42:06 +05:30
parent 2dbae3d1ff
commit 9b5e916709
8 changed files with 2677 additions and 0 deletions

22
boilerplates/validator.js Normal file
View File

@@ -0,0 +1,22 @@
const { body, header, param, query } = require("express-validator");
const typedefs = require("../typedefs");
/**
* @param {typedefs.Req} req
* @param {typedefs.Res} res
* @param {typedefs.Next} next
*/
const __validator_func = async (req, res, next) => {
await body('field_name')
.notEmpty()
.withMessage('field_name not defined in body')
.run(req);
next();
}
module.exports = {
__validator_func,
}