Shafayat Alam Shafayat Alam - 1 year ago 109
Javascript Question

Number of parameters sent via URL in nodeJS

I need to find how many parameters sent in an URL.

How can I determine the number of parameters sent via URL in nodeJS?

Answer Source

use req.query

if Your URL is like localhost:3000?param1=&param2=

var params = req.query;
van length = Object.keys(params).length;

the length is 2.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download