Again, nice start to modularisation and seperation of concerns, but could be improved.
All the router should do is pass the (req, res) onto a handler, and then the handler does everything with it. So you have
router = (req, res) => {
if (option1)
handler1(req,res)
if (option2)
handler2(req,res)
}
Everything you need is within those request and response arguments. This then is much neater, easier to read and easier to replicate.
If for example, one person writes the router, they can always pass the (req,res) arguments to every handler, and then whoever is making the handlers will always know to make a function with those two arguments
Again, nice start to modularisation and seperation of concerns, but could be improved.
All the router should do is pass the (req, res) onto a handler, and then the handler does everything with it. So you have
Everything you need is within those request and response arguments. This then is much neater, easier to read and easier to replicate.
If for example, one person writes the router, they can always pass the
(req,res)
arguments to every handler, and then whoever is making the handlers will always know to make a function with those two arguments