From 79b20e4e5163ea13c0d07c92d329738ffd83afed Mon Sep 17 00:00:00 2001 From: Manna Kong Date: Wed, 30 Jun 2021 16:58:16 -0500 Subject: [PATCH] partially done with homepage --- routes/index.js | 4 ++-- views/index.pug | 1 - views/trail-detail.pug | 7 +++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/routes/index.js b/routes/index.js index 1cfd560..944a689 100644 --- a/routes/index.js +++ b/routes/index.js @@ -10,9 +10,9 @@ router.get('/', csrfProtection, asyncHandler(async(req, res) => { res.render('index', ({ trails })); })); -router.get('/trails/:id(\\d+)', csrfProtection, asyncHandler(async(req, res, next) => { +router.get('/trail/:id(\\d+)', csrfProtection, asyncHandler(async(req, res, next) => { const trailId = parseInt(req.params.id, 10); - const trail = await db.Trails.findByPk(trailId); + const trail = await db.Trail.findByPk(trailId); res.render('trail-detail', { title: "Park Detail", trail diff --git a/views/index.pug b/views/index.pug index fd0267e..63f448c 100644 --- a/views/index.pug +++ b/views/index.pug @@ -14,7 +14,6 @@ block content h1 MixTrail div(class="search") input(type="text" id="search-bar" class="search-bar" placeholder="Find your next trail!") - div(class="test") each trail in trails div(class="trail-div") diff --git a/views/trail-detail.pug b/views/trail-detail.pug index e69de29..bb5cfcf 100644 --- a/views/trail-detail.pug +++ b/views/trail-detail.pug @@ -0,0 +1,7 @@ +extends layout.pug + +block content + div + p= trail.name + img(src=`../trails/trail-${trail.id}.jpg` alt=`${trail.name}` class=`trail-image-${trail.id}`) + p= trail.description