I am using node.js with express. I am trying to set up a basic server, but have no idea why I am getting a response error.
var http = require('http');
var myServer = http.createServer(function(req,res){
response.writeHead(200, {"Content-Type" : "text/plain"});
response.write('Hello World');
response.end();
});
myServer.listen(3000);
function(req,res)
is supposed to be
function(req, response) {
You don't have a variable named response
in the scope of the callback. That is the reason for the reference error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With