In this video we are going to learn about Route parameters.
Route parameters are named URL segments that are used to capture the values specified at their position in the URL.
The captured values are populated in the req.params object,
with the name of the route parameter.
specified in the path as their respective keys.
So lets see how can we use route parameter.
So go to the project and inside index.js lets create a route.


app.get('/users/:username',function(req,res){
var users = {
'user1':{
Name:\"jenifer\".
Age:25,
Sex:female
},
'user2':{
Name:\"John\",
Age:28,
Sex:male
}
}
res.render('user',{'user':user[req.params.username]});
});


Now lets create a view.
Go inside the views folder create new file.
Lets see file name is user.ejs.
Now open user.ejs file and write following code.


<!DOCTYPE html>
<html lang=\"en\">
<head>
<meta charset=\"UTF-8\">
<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<title>User</title>
</head>
<body>
<h1>User Details</h1>
<p><%= user.name ></p>
<p><%= user.age ></p>
<p><%= user.sex ></p>
</body>
</html>


Alright now save all.
Lets run this Now switch to the command prompt run the command.


node index.js


Now go to the browser and go to the url /users/user1
You can see here the user1 name age and sex.
If I change the username with /user2.
Then you can see here the user2 details.
So in this way you can use Route Parameter.