Skip to content Skip to sidebar Skip to footer

The Res.write In Express Displays The Html Element Inside Of It

I am not to web app dev and I started using express and I have this code app.post('/', function(req, res) { var crypto = req.body.crypto; var fiat = req.body.fiat; var amoun

Solution 1:

Try any of the below codes before this line:

res.write("Current time is: " + time);

  • res.writeHead(200, {'Content-Type': 'text/html'})
  • res.header('Content-Type', 'text/html')
  • res.type('text/html')

After this, try clearing cache too if it doesn't help.

That's actually just vanilla nodejs. Read more here: https://nodejs.org/api/http.html#http_response_writehead_statuscode_statusmessage_headers

Post a Comment for "The Res.write In Express Displays The Html Element Inside Of It"