var server = http.createServer(function(req, res) { res.writeHead(200); res.end('Hello Http'); }); 

Where do the req and res arguments come from? (abstract example)

1 answer 1

If you are interested in how to create methods that work from callback , then here is an example:

 var myHttp = { createServer: function(callback) { var someMyData = { hoho: true, haha: true }; callback(someMyData); } } myHttp.createServer(function(obj) { console.log(obj); }) 

Also work for example Promise . Frequently enough practice