Shafayat Alam Shafayat Alam - 3 months ago 11
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

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.