From 0962bf0e0f41f5d31368dfd2a65df680644772ed Mon Sep 17 00:00:00 2001 From: Badri Sunderarajan Date: Thu, 25 Feb 2021 12:07:08 +0530 Subject: [PATCH] Implement test "add" endpoint to check body parsing and response Now we know whether we can read and write JSON properly! --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index 57f8a22..5f1472d 100644 --- a/index.js +++ b/index.js @@ -12,3 +12,8 @@ app.listen(5000, () => { app.get("/", (req, res) => { res.send("Hi!") }) + +app.post("/add", (req, res) => { + const { a, b } = req.body + res.send({ result: a + b }) +})