node-express error : express deprecated res.send(status): Use res.sendStatus(status) instead

前端 未结 7 897
甜味超标
甜味超标 2020-12-09 09:22

I am trying to send an integer via response.send() but I keep getting this error

express deprecated res.send(status): Use res.sendStatus

7条回答
  •  有刺的猬
    2020-12-09 09:32

    (as mentioned in the comments already)

    The manual states:

    The body parameter can be a Buffer object, a String, an object, or an Array.

    So integers aren't directly supported and need to be converted to one of those types first. For instance:

    response.send(String(idTest));
    

提交回复
热议问题