Multiple request handling with node.js

I am fairly new to node and some things still don't really make sense, so bare with me. This may be a trivial task for experienced node people, but I am struggling to get what I want to work.

I want to make some type of relay server:

  • send a request to the node server from some client like: http myServer:port/node1?command=foo&type=bar
  • parse out the request.url: /node1?command=foo&type=bar
  • send a GET to the second server with request.url attached and receive a JSON object from the server(request.url) according to the request : http someOtherServer/node1?command=foo&type=bar
  • deliver the JSON object back to the client

Currently I have access to the url from the request, but as you may know that's not a hard task, since it's 'request.url'. Basically I want to call a heroku instance from an iPhone app, have the heroku instance relay the request to another server and send the response back to the iPhone app.

Help appreciated. Thanks.