Express.js- add response body

后端 未结 2 1717
孤街浪徒
孤街浪徒 2021-02-14 17:43

I would like to add a body property to Express.js\' response object, which will be called every time the send method is called, I do it by adding the f

2条回答
  •  情深已故
    2021-02-14 18:19

    You have to use res.json(body). It will send "body" as a response body.Make sure body should be object.

提交回复
热议问题