XMen XMen - 2 years ago 146
Node.js Question

How to get GET (query string) variables in Express.js on Node.js?

Can we get the variables in the query string in Node.js just like we get them in

in PHP?

I know that in Node.js we can get the URL in the request. Is there a method to get the query string parameters?

Answer Source

Yes you can:

var url = require('url');
var url_parts = url.parse(request.url, true);
var query = url_parts.query;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download