Seconding the recommendation to use request. That's the server side equivalent to making an xhr on the client side.