Manually, you could structure it in several functions like prepare_response() and render_response(), possibly with other functions in-between for the various chunks of data you need in your response. When all the chunks are ready, you finally call render_response() and send it.
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