From 71bde97226a3e628346bf2b78b15f1164eea99fe Mon Sep 17 00:00:00 2001 From: counterweight Date: Sun, 1 Jun 2025 18:55:35 +0200 Subject: [PATCH] completed 3.7 and 3.8 --- parts/3/notes.md | 2 ++ parts/3/phonebookBackend/index.js | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/parts/3/notes.md b/parts/3/notes.md index ae76652..4a37c7b 100644 --- a/parts/3/notes.md +++ b/parts/3/notes.md @@ -5,3 +5,5 @@ Exercises: * [X] 3.4 * [X] 3.5 * [X] 3.6 +* [X] 3.7 +* [X] 3.8 diff --git a/parts/3/phonebookBackend/index.js b/parts/3/phonebookBackend/index.js index 62f2b97..eb222e0 100644 --- a/parts/3/phonebookBackend/index.js +++ b/parts/3/phonebookBackend/index.js @@ -8,7 +8,15 @@ const unknownEndpoint = (request, response) => { app.use(express.json()); -app.use(morgan("tiny")); +morgan.token("reqBody", (req) => { + return JSON.stringify(req.body); +}); + +app.use( + morgan( + ":method :url :status :res[content-length] - :response-time ms - :reqBody" + ) +); const persons = [ {