Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispsheehan committed Feb 23, 2024
1 parent 4645bb6 commit 9d027c3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 9d027c3

Please sign in to comment.