From f8c8e66137e1fa781400523afd178c026f9b7947 Mon Sep 17 00:00:00 2001 From: _moliNasil <41929823+nahuelmol@users.noreply.github.com> Date: Tue, 24 Aug 2021 16:30:03 -0300 Subject: [PATCH 1/5] Update app.js --- app.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app.js b/app.js index 77bb4b7..b6ca8d8 100644 --- a/app.js +++ b/app.js @@ -10,6 +10,9 @@ const randomRouter = require("./routes/random"); app.use('/random/:type', randomRouter); app.use('/', indexRouter); +app.set("view engine", "pug"); +app.set("views", path.join(__dirname, "public")); + app.use(function (req, res, next) { res.sendStatus(404); }); From 83979c7b0d603c8c6be38b63f79c8a4b91e3221e Mon Sep 17 00:00:00 2001 From: _moliNasil <41929823+nahuelmol@users.noreply.github.com> Date: Tue, 24 Aug 2021 16:34:45 -0300 Subject: [PATCH 2/5] Create home.pug --- public/home.pug | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 public/home.pug diff --git a/public/home.pug b/public/home.pug new file mode 100644 index 0000000..946a16b --- /dev/null +++ b/public/home.pug @@ -0,0 +1,6 @@ + + + Home + + + From 51e62505ef44ac816282b979c0fe7541ee9fc457 Mon Sep 17 00:00:00 2001 From: _moliNasil <41929823+nahuelmol@users.noreply.github.com> Date: Tue, 24 Aug 2021 16:37:53 -0300 Subject: [PATCH 3/5] Update index.js --- routes/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routes/index.js b/routes/index.js index c1da291..8a839a0 100644 --- a/routes/index.js +++ b/routes/index.js @@ -6,4 +6,8 @@ router.get('/', function(req, res, next) { res.sendFile(path.join(__dirname, '../public/index.html')); }); +router.get('/home', (req, res) => { + res.render('home'); +}); + module.exports = router; From 1e953ea46ef99e4bc7d809c7ba75428af0d97e5e Mon Sep 17 00:00:00 2001 From: _moliNasil <41929823+nahuelmol@users.noreply.github.com> Date: Tue, 24 Aug 2021 16:55:17 -0300 Subject: [PATCH 4/5] Update index.js --- routes/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routes/index.js b/routes/index.js index 8a839a0..e5cca26 100644 --- a/routes/index.js +++ b/routes/index.js @@ -7,7 +7,11 @@ router.get('/', function(req, res, next) { }); router.get('/home', (req, res) => { - res.render('home'); + const context = { + message:'You are in the home page', + from:'user'} + + res.render('home', context); }); module.exports = router; From 58c2232c9e2d24cdfb5f2874396184dccdbbc5b1 Mon Sep 17 00:00:00 2001 From: _moliNasil <41929823+nahuelmol@users.noreply.github.com> Date: Tue, 24 Aug 2021 16:57:15 -0300 Subject: [PATCH 5/5] Update home.pug --- public/home.pug | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/home.pug b/public/home.pug index 946a16b..da005e6 100644 --- a/public/home.pug +++ b/public/home.pug @@ -1,6 +1,6 @@ - - - Home - - - +html + head + title= 'Home Page' + body + h1= message + p= from