77.7k views
2 votes
Http://localhost:8080/newuser?name=Max&age=22&address=ACT how do you access the attributes in the query string

Option 1: req.queryParams
Option 2: req.body
Option 3: req.params
Option 4: req.query

User Rosscova
by
7.8k points

1 Answer

2 votes

Final answer:

To access the attributes in the query string, you can use the req.query option.

Step-by-step explanation:

To access the attributes in the query string, you can use the req.query option. This option allows you to access the individual attributes as key-value pairs. For example, if the query string is ?name=Max&age=22&address=ACT, you can access the name attribute using req.query.name, the age attribute using req.query.age, and the address attribute using req.query.address.

User Rasean
by
8.8k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.