0

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

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

2 Answers 2

2

If using express framework

req.params // can be used

See the documentation here

Sign up to request clarification or add additional context in comments.

Comments

1

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.

1 Comment

is that same for an url like this : https://books.google.com.bd/books?id=y6hEAAAAYAAJ&q=jules+verne&dq=jules+verne&hl=en&sa=X&redir_esc=y

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.