Sorry, nothing off the top of my head, but a good starting point would be googling for stuff like "node event driven" or maybe "event driven programming" in general.
My get_username() function, say I have this code:
var server = http.createServer(function(req, res) {
username = get_username();
res.writeHead(200);
res.write("<html>");
res.write("You are " + username);
res.end("bye");
This obviously won't work, res.end() gets fired long before my DB query in get_username() finishes. How else would I accomplish what I'm trying to do here other than putting my response stuff in the DB query's callback function?<Sorry for the newb question, buy what I'm doing: having the response generated inside of the query's callback, seems to be the way most of these node tutorials suggest.>
In practice, you can find a ton of libraries that can help you manage this [1], I -believe- the most recommended one would be 'futures'.
[1] https://github.com/joyent/node/wiki/modules#wiki-async-flow