In the middleware unit of the Complete Node.js course, we create a Logger.js module with a log function, and export that with module.exports = log. Then in index.js, this is pulled in with the typical require statement and used with app.use(logger).
Then we pull in some third party middleware, namely helmet and morgan. These are likewise pulled in with require statements, and used as follows:
Hopefully this is not a silly question, but I am trying to figure out why for the logger it is app.use(logger) instead of app.use(logger()) like for helmet and morgan? I have tried playing around with the module.exports in logger.js. I feel like I am overlooking the obvious. Any explanations on this are appreciated.