I think a fake example will answer your question:
var http = require('http'); var db = require('db'); http.createServer(function (req, res) { db.query('fake query', function(data){ res.send(data); } }).listen(1337, '127.0.0.1');
Even if you do not send your response synchronously, thatβs fine, thatβs how node works. At first, I also struggled with this concept.
billy source share