Might be a good idea to abstract Middlewares in such a way that if a @RequestParam is declared, only specified params will be given to a method and e.g. return next() will be called automatically afterwards.
Internal Call
const requestParam = ({value, default}) => {
return (target, propertyKey, descriptor) => {
// some other important stuff happening beforeHand of course
app.get('/hello', (ctx,next) => {
// get Param from ctx and set default if none
const param = ctx.params[value] ?? default;
// actual method call
component[propertyKey](ctx.params['name']
// call next middleware
return next();
});
}
};
Corresponding Java/Spring example:
Might be a good idea to abstract Middlewares in such a way that if a @RequestParam is declared, only specified params will be given to a method and e.g.
return next()
will be called automatically afterwards.Internal Call