gdsc-kaist / board-of-audit-and-inspection-system

KAIST board of audit and inspection system backend
https://dev-bai.gdsckaist.com/api-docs
0 stars 2 forks source link

API request body is not passed to middleware when middleware is registered with router.use #33

Open Byunk opened 8 months ago

Byunk commented 8 months ago

Undefined is passed to middleware when the middleware is registered with router.use.

The error case:

router.use(wrapAsync(validateOrganization));
router.get(
        '/:organization_id/:year/:half',
        wrapAsync(async (req: Request, res: Response, next: NextFunction) => {
...
}

It is resolved if:

router.get(
        '/:organization_id/:year/:half',
        wrapAsync(validateOrganization),
        wrapAsync(async (req: Request, res: Response, next: NextFunction) => {
...
}