In rails I do a POST request to my server:
response = Typhoeus::Request.post("http://url.localtunnel.com/request?from=ola&to=ole")
result = JSON.parse(response.body)
In the Node.js app, I want to read From
and To
:
app.post '/request', (req,res) ->
console.log "I have received a request, sweet!!"
sys.log req.params.from
#sys.log "From: " + req.from + ", To: " + req.to + ", Id: " + req.id
How do I do it?
Thanks
The answer is:
Something like this:
url.parse
is a key point... Or you can usequerystring.parse(urlString)
You can read more at http://nodejs.org docs section.