title: Index page in node app only routing to first show page
body: <p>I'm building a goals app with node/express/psql. When I click on a goal on the index page, I want it to link to the show page for that goal. However, each one is linking to the goal with the id=1. I'm confused because the .forEach I use to print the objects in the first place is working, just not the link. Any help would be appreciated!</p>
  
  <p>index.ejs:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
     &lt;link rel="stylesheet" href="styles.css"&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;Goals&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt;Here's a look at all of your goals!!&lt;/h1&gt;
    &lt;a href="/goals/new"&gt;New Goal?&lt;/a&gt;
       &lt;% goals.forEach(goal =&gt; { %&gt;
       &lt;div class="goal-container"&gt;
        &lt;h2&gt;&lt;a href="&lt;%= `/goals/${goal.id}` %&gt;"&gt;&lt;%= goal.description %&gt;&lt;/a&gt;&lt;/h2&gt;
        &lt;p&gt;&lt;%= goal.step1 %&gt;&lt;/p&gt;
        &lt;p&gt;&lt;%= goal.step2 %&gt;&lt;/p&gt;
        &lt;p&gt;&lt;%= goal.step3 %&gt;&lt;/p&gt;
        &lt;p&gt;&lt;%= goal.step4 %&gt;&lt;/p&gt;
        &lt;/div&gt;
      &lt;% }) %&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>controller: </p>
  
  <pre><code>const Goal = require('../models/goal');
  const goalsController = {};
  
  goalsController.index = (req, res) =&gt; {
    Goal.findAll(req.user.id)
    .then(goal =&gt; {
      res.render('goals/', { goals: goal });
    })
    .catch(err =&gt; {
      res.status(400).json(err);
    });
  };
  
  goalsController.show = (req, res) =&gt; {
    Goal.findById(req.params.id)
      .then(goals =&gt; {
        console.log('goals show');
        res.render(`goals/show`, { goals:goals })
      })
      .catch(err =&gt; {
        res.status(400).json(err);
      });
  };
  
  module.exports = goalsController;
  </code></pre>
  
  <p>routes:</p>
  
  <pre><code>const express = require('express');
  const goalsController = require('../controllers/goals-controllers');
  const goalsRouter = express.Router();
  
  goalsRouter.get('/', goalsController.index);
  goalsRouter.get('/new', goalsController.new);
  goalsRouter.get('/:id', goalsController.show);
  goalsRouter.get('/:id/edit', goalsController.edit);
  goalsRouter.put('/:id', goalsController.update);
  goalsRouter.post('/', goalsController.create);
  goalsRouter.delete('/:id', goalsController.delete);
  
  module.exports = goalsRouter;
  </code></pre>
  
  <p>model:</p>
  
  <pre><code>const db = require('../db/config');
  const Goal = {};
  
  Goal.findAll = id =&gt; {
    return db.query(`SELECT * FROM goals JOIN users ON goals.user_id = users.id WHERE goals.user_id = $1`, id)
  };
  
  
  Goal.findById = id =&gt; {
    console.log('findbyId')
    return db.oneOrNone(`SELECT * FROM goals WHERE id = $1`, [id])
  };
  
  module.exports = Goal;
  </code></pre>
  
  <p>Thanks in advance!</p>