Make defer and xhr work in node