Here below is my code:
const express = require('express');
const app = express();
app.get('/', function (req, res) {
res.setHeader('Content-Type', 'text/html');
res.write("First \n");
setTimeout(() => {
res.end("Done");
},2000);
});
app.listen(3000, () => {
console.log("Server is running on port 3000")
})
Now, If I access the browser using http://localhost:3000 then on access URL it shows First on the browser and after two seconds it shows Done. which is fine.
but when I try this on POSTMAN why it shows
First
Done
together. Can anyone explain the reason for it? Or Is this possible or not to get the same behaviour of response on postman as well?