重新发送
- res.send仅在Express js中。
- 为简单的非流式响应执行许多有用的任务。
- 能够自动分配Content-Length HTTP响应标头字段。
- 能够提供自动的HEAD和HTTP缓存新鲜度支持。
实际说明
res.send
只能被调用一次,因为它等同于res.write
+res.end()
- 例
app.get('/user/:id', function (req, res) { res.send('OK'); });有关更多详细信息expressjs.com/en/api.html
重新写入
- 可以多次调用以提供身体的连续部分。
- 例
response.write('<html>'); response.write('<body>'); response.write('<h1>Hello, World!</h1>'); response.write('</body>'); response.write('</html>'); response.end();有关更多详细信息,请
参见
nodejs.org/docs
nodejs.org/en/docs/guides



