I am reading expressjs documentation and i sow that the response to the user can be sent like this:
res.status(404).send('Sorry, we cannot find that!') //or
res.status(201).send('posted')
I want to know if according to best practices, is ok to send the shttp status code like this:
res.send({
data: {
user: "John
},
statusCode: 201,
message: "POsted success"
})
It is ok the last structure or it exist another way to send data about the status?
PS: I am new to node js