0

I try to write a server which will manage some get requests like this: GET http://some-server.aa:1337/action?param1=1000&param2=1000 But I can't parse param1 and param2 from url because param2 not appear on server part.

app.get('/action', function(req, res) { 

  var parts = url.parse(req.url, true);
  var query = parts.query;
        console.log('keys: '+Object.keys(query)); //output: keys: caller
        console.log('url: '+parts.path); // output: url:/action?param1=1000

}); 

I use express, url, and path modules. if I'l be able to receive on server full url, then
But before this, I need to be able to receive full path from req. Have any ideas?
UPD
how it's look from my side: https://dl.dropboxusercontent.com/u/12720156/nodejsbug.png

Alex Cebotari
  • 291
  • 2
  • 4
  • 9

1 Answers1

0

Problem was not in node.js. It was in CURL request which I use. From browser it works fine. Solution was found here: How to pass multiple parameters to cron job with curl?
with request: curl -sS 'http://server.aa:1337/action?param1=1&param2=2' it works fine.

Community
  • 1
  • 1
Alex Cebotari
  • 291
  • 2
  • 4
  • 9