I have an api that calls:
http://example.com/games?maxplayers=10
then I use
url.parse(req.url,true).query
which returns:
{ maxplayers: '10' }
I would like to replace the string that contains 10 with the actual int value of 10 so I can query my database and return a result. As of right now it returns no result because it recognizes the 10 as a string. Any insight?
EDIT:
I tried this:
var example = parseInt(url.parse(req.url,true).query)
console.log(example);
However all it prints is "NAN"
I need it to return:
{ maxplayers: 10 }