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:
parent
b9f9986202
commit
0962bf0e0f
1 changed files with 5 additions and 0 deletions
5
index.js
5
index.js
|
@ -12,3 +12,8 @@ app.listen(5000, () => {
|
||||||
app.get("/", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
res.send("Hi!")
|
res.send("Hi!")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.post("/add", (req, res) => {
|
||||||
|
const { a, b } = req.body
|
||||||
|
res.send({ result: a + b })
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in a new issue