I am a beginner to express.js
and I am trying to understand the difference between res.send
and res.write
?
res.send
res.send
is only in Express.js.Content-Length
HTTP response header field.res.send
can only be called once, since it is equivalent to res.write
+ res.end()
app.get('/user/:id', function (req, res) {
res.send('OK');
});
For more details:
res.write
response.write('');
response.write('');
response.write('Hello, World!
');
response.write('');
response.write('');
response.end();
For more details: