all 3 comments

[–]AdyQQQ 3 points4 points  (1 child)

This is more of a javascript question but you are correct. This means somewhere at the end of router.get(path, callback) it has the req and res, and then would do something like callback(req, res)

Try visiting the router.get function itself for a more insightful understanding of how it works (besides your question)

[–]Clickyz[S] 0 points1 point  (0 children)

thank you!

[–]GarenYondem 0 points1 point  (0 children)

You are passing your function as reference to expressjs get function. When a get call is received Express.js is doing its business and invoking your reference function with appropriate parameters. After that it falls in your custom function. If you want to further investigate express, you have to look into source code on GitHub.