-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
applying for Each loop on array list
- Loading branch information
1 parent
94b9dd4
commit 2af19d4
Showing
2 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const express = require('express'); | ||
|
||
|
||
const port = 8000; | ||
const app = express(); | ||
|
||
//Telling Node Js that ue are using view engine of ejs | ||
app.set('view engine' , 'ejs'); | ||
|
||
app.get('/' , (req , res) => { | ||
res.render('home'); | ||
}) | ||
|
||
app.get('/profile' , (req , res) => { | ||
user = { | ||
name:'Anil', | ||
email:'[email protected]', | ||
city:'Noida', | ||
skills:['HTML' , 'Css' , 'Js' , 'Node Js' , 'Java'] | ||
} | ||
res.render('profile' , {user}); | ||
}); | ||
|
||
|
||
app.listen(port , (err) => { | ||
if(!err){ | ||
console.log(`Server is running on the port::${port}`); | ||
} | ||
}); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
<!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"> | ||
<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>Profile page</title> | ||
</head> | ||
<body> | ||
</head> | ||
<body> | ||
|
||
<h1>Profile Page</h1> | ||
<h3>Welcome <%= user.name %></h3> | ||
<h3>Email:<%= user.email %></h3> | ||
<h3>City:<%= user.city %></h3> | ||
</body> | ||
</html> | ||
<h3>Skills:<%= user.skills %></h3> | ||
|
||
<!-- Appliying forEach loop on skills --> | ||
<ul> | ||
<% user.skills.forEach((item) => { %> | ||
<li><%= item %></li> | ||
<% }) %> | ||
</ul> | ||
|
||
</body> | ||
</html> |