I am a beginner to express.js
and I am trying to understand the difference between res.send
& 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('<html>');
response.write('<body>');
response.write('<h1>Hello, World!</h1>');
response.write('</body>');
response.write('</html>');
response.end();
For more details: