Implement test "add" endpoint to check body parsing and response

Now we know whether we can read and write JSON properly!
This commit is contained in:
Badri Sunderarajan 2021-02-25 12:07:08 +05:30
parent b9f9986202
commit 0962bf0e0f

View file

@ -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 })
})