chore: relocate backend into apps/api ahead of monorepo merge

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 12:20:40 +08:00
co-authored by Claude Sonnet 5
parent af44598df6
commit eaa6d2276a
388 changed files with 0 additions and 13998 deletions
@@ -0,0 +1,25 @@
/***********************************************************************************************************************************************************************
* File Name: validate.middleware.js
* Type of Program: Middleware
* Description: express-validator result checker.
* Pairs with validators/*.validator.js — those files define the rules,
* this file intercepts the request if any rule failed and returns 422.
* Author: rgrgogu
* Date Created: Oct. 6, 2025
***********************************************************************************************************************************************************************
* HOW TO USE:
* const { registerValidator } = require('../../validators/auth.validator');
* const { validate } = require('../../middleware/validate.middleware');
* router.post('/register', ...registerValidator, validate, handler);
***********************************************************************************************************************************************************************/
const { validationResult } = require('express-validator');
const R = require('../utils/response.util');
const validate = (req, res, next) => {
const errors = validationResult(req);
if (!errors.isEmpty())
return R.validationError(res, errors.array());
next();
};
module.exports = { validate };