vendredi 20 février 2015

replacing string number with actual number itself

I have an api that calls:


http://localhost:3000/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?


Aucun commentaire:

Enregistrer un commentaire