From 8853ca09e7b5970ce6da272899fb9da53998992e Mon Sep 17 00:00:00 2001 From: chrispsheehan Date: Wed, 11 Sep 2024 19:34:03 +0100 Subject: [PATCH] log all requests --- src/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app.js b/src/app.js index 1acf5e7..9a65d05 100644 --- a/src/app.js +++ b/src/app.js @@ -8,6 +8,11 @@ const port = process.env.PORT; app.listen(port) +app.use((req, res, next) => { + console.log(`Request received: ${req.method} ${req.url}`); + next(); +}); + app.get('/hello', (req, res) => { res.status(200).json({msg: "Hello, this is your API"}); });