Tuesday, 14 March 2017

Where are the request and response coming from?

On line 2, there are 'request' and 'response' parameters to be received, yet on line 6, in the createServer call, I pass it the request handler function, with no arguments. Where do these two specific parameters come from if I'm not passing them on invocation?

var http = require("http");
function requestHandler(request, response) {
  console.log();
  response.end();
}
var server = http.createServer(requestHandler);
server.listen(3000);



via user58337

No comments:

Post a Comment