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 trialJonathan Drake
Full Stack JavaScript Techdegree Student 11,668 PointsText not displaying...
I've copied and pasted Andrew's code (which matched mine but I copied and pasted to make sure) and the 'text' of the question is not displaying. I changed the variable in the card.pug file from 'prompt' to 'text' to match the code in the cards.js file but the only thing that display is the hint. Here's the code from the cards.js file:
const express = require('express'); const router = express.Router(); const { data } = require('../data/flashcardData.json'); const { cards } = data;
router.get('/:id', (req, res) => { const { side } = req.query; const { id } = req.params; const text = cards[id][side]; const { hint } = cards[id]; const templateData = { text, hint };
res.render('card', templateData);
})
module.exports = router;
And the code from the card.pug:
extends layout.pug
block content section#content h2= prompt if hint p i Hint: #{hint}
1 Answer
Jonathan Drake
Full Stack JavaScript Techdegree Student 11,668 PointsNevermind! I wasn't using the query string in the url... it's always something simple. In woodworking we say "measure twice cut once"...same idea applies here
Jonathan Drake
Full Stack JavaScript Techdegree Student 11,668 PointsJonathan Drake
Full Stack JavaScript Techdegree Student 11,668 Pointsnot sure why the code got bunched like that...