Sunday 23 April 2017

Question about Node.js servers

From what I've read, 200 is the HTTP status code for success, but how can we write 200 before we know if the program will be successful?var http = require('http'); var server = http.createServer(function(req, res){ res.writeHead(200, {'Content-Type': 'text/plain'}); //What I mean res.end('Hey ninjas!'); }); server.listen(3000);

Submitted April 23, 2017 at 08:30PM by jimmypixel

No comments:

Post a Comment