In this video we are going to learn about Query String.
The query string is the part that comes after the URL path and starts with a question mark ('?')
Let's see how to get the query string properties and their values.
Go to the index.js file and create a route.
Now lets check.
So go to command prompt and run index.js file.
Now switch to browser and go to the url /user and here enter the query string ?name=jenifer&age=25.
You can see here the name and age.
So in this way you can retrieve query string property.
The query string is the part that comes after the URL path and starts with a question mark ('?')
Let's see how to get the query string properties and their values.
Go to the index.js file and create a route.
app.get('/user',(req,res)=>{
var name = req.query.name;
var age = req.query.age;
res.send('Name:'+name + 'Age:'+age);
});
Now lets check.
So go to command prompt and run index.js file.
node index.js
Now switch to browser and go to the url /user and here enter the query string ?name=jenifer&age=25.
You can see here the name and age.
So in this way you can retrieve query string property.