From 230ca364aacca6175ca6474c4321beb9558f9fed Mon Sep 17 00:00:00 2001 From: Vivek Date: Sat, 2 Jul 2022 22:13:51 +0530 Subject: [PATCH] creating common header file for all ejs files --- common/header.ejs | 5 +++++ index2.js | 4 ++++ public/index.html | 3 ++- views/login.ejs | 13 +++++++++++++ views/profile.ejs | 1 + 5 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 common/header.ejs create mode 100644 views/login.ejs diff --git a/common/header.ejs b/common/header.ejs new file mode 100644 index 0000000..d551b0d --- /dev/null +++ b/common/header.ejs @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/index2.js b/index2.js index a6152ac..7e5e9d3 100644 --- a/index2.js +++ b/index2.js @@ -21,6 +21,10 @@ app.get('/profile' , (req , res) => { res.render('profile' , {user}); }); +app.get('/login' , (req , res) => { +res.render('login') +}) + app.listen(port , (err) => { if(!err){ diff --git a/public/index.html b/public/index.html index b8acc56..df5cff7 100644 --- a/public/index.html +++ b/public/index.html @@ -7,6 +7,7 @@ Index page +

Index page

- \ No newline at end of file + diff --git a/views/login.ejs b/views/login.ejs new file mode 100644 index 0000000..a7f620a --- /dev/null +++ b/views/login.ejs @@ -0,0 +1,13 @@ + + + + + + + Login Page + + + <%- include('../common/header') %> +

This is Login Page

+ + \ No newline at end of file diff --git a/views/profile.ejs b/views/profile.ejs index 3344a67..6a797e9 100644 --- a/views/profile.ejs +++ b/views/profile.ejs @@ -8,6 +8,7 @@ + <%- include('../common/header') %>

Profile Page

Welcome <%= user.name %>

Email:<%= user.email %>