From 9d027c35d2d38e3210666ffa38cde35627da3f0e Mon Sep 17 00:00:00 2001 From: chrispsheehan Date: Fri, 23 Feb 2024 15:19:48 +0000 Subject: [PATCH] add logging --- src/app.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app.js b/src/app.js index c1c168d..8ce3ceb 100644 --- a/src/app.js +++ b/src/app.js @@ -6,6 +6,13 @@ app.get('/hello', (req, res) => { res.status(200).json({msg: "Hello, this is your AWS Lambda function, [mushroom] testy badgers!"}); }); +app.use((req, res, next) => { + console.log(`Params: ${JSON.stringify(req.params)}`); // log out requests + console.log(`Headers: ${JSON.stringify(req.headers)}`); + console.log(`${req.method}: ${JSON.stringify(req.url)}`); + res.status(200).json({msg: "Hello, this is your AWS Lambda function, [mushroom] testy badgers!"}); +}) + const server = awsServerlessExpress.createServer(app); exports.handler = (event, context) => {