// src/routes/myMultipleCallbacksRoute.tsimportBaseRoutefrom"src/utils/structures/BaseRoute";functionMultiple(...functions){returnfunction(target:Object,key:string|symbol,descriptor:PropertyDescriptor){constoriginal=descriptor.value;descriptor.value=function(...args:any[]){functions.forEach((func)=>func(...args));original.apply(this,args);};returndescriptor;};}exportdefaultclassmyMultipleCallbacksRouteextendsBaseRoute{constructor(){super("/myMultipleCallbacksRoute");}@Multiple(function(_,__,next){console.log("Middleware could be here :eyes:");next();},function(req,__,next){if(req.body.id){console.log("Maybe only return next callback only if req.body.id was provided :eyes:");}next();})asyncrun(req,res){res.send("Hello!");}}
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)