res.send([body])
Sends the HTTP response.
The body parameter can be a Buffer object, a String, an object, Boolean, or an Array. For example:
res.send(Buffer.from('whoop'))
res.send({ some: 'json' })
res.send('
some html
')
res.status(404).send('Sorry, we cannot find that!')
res.status(500).send({ error: 'something blew up' })
This method performs many useful tasks for simple non-streaming responses: For example, it automatically assigns the Content-Length HTTP response header field (unless previously defined) and provides automatic HEAD and HTTP cache freshness support.
When the parameter is a Buffer object, the method sets the Content-Type response header field to “application/octet-stream”, unless previously defined as shown below:
res.set('Content-Type', 'text/html')
res.send(Buffer.from('
some html
'))
When the parameter is a String, the method sets the Content-Type to “text/html”:
res.send('
some html
')
When the parameter is an Array or Object, Express responds with the JSON representation:
https://expressjs.com/en/5x/api.html#res.send