Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Rochelle Burrows
Rochelle Burrows
8,528 Points

No answer link on the "questions" page

Not sure what's happening, but the answer link isn't appearing in the questions route of my app. The "question" link however, is appearing just as expected on the answer route! Please help if you can see what I don't.

Here is my code:

 const { side } = req.query;
  const { id } = req.params;
  const text = cards[id][side];
  const { hint } = cards[id];

  const templateData = { id, text };

  if( side === "question" ) {
    templateData.hint = hint;
    templateData.sideToShow = 'answer';
    templateData.sidetoShowDisplay = "Answer";
  } else if (side === "answer") {
    templateData.sideToShow = "question";
    templateData.sideToShowDisplay = "Question";

  res.render("cards", templateData);

Pug template:

a(href=`${id}?side=${sideToShow}`)= sideToShowDisplay

1 Answer

Rochelle Burrows
Rochelle Burrows
8,528 Points

Figured it out myself. Tiny bug in the form of a typo. Lower case "t" should be upper case "T" in the property "sideToShowDisplay".

    templateData.sidetoShowDisplay = "Answer";