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

JavaScript

Jason Nutt
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jason Nutt
Front End Web Development Techdegree Graduate 24,760 Points

Cannot figure out where this disconnect is happening.

I will include code that works and the change that breaks it. I am trying to change from asking for the question and hint's index to asking for the req object's params and the id that i just assigned as a variable to the route that we are working with here. I hope that is clear.......

``` const express = require('express'); const router = express.Router(); const { data } = require('../data/flashcardData.json'); const { cards } = data;

router.get('/', (req, res) => { res.render('card.pug', { prompt: cards[0].question, hint: cards[0].hint }); });

module.exports = router; ```

That works and this does not

``` const express = require('express'); const router = express.Router(); const { data } = require('../data/flashcardData.json'); const { cards } = data;

router.get('/:id', (req, res) => { res.render('card.pug', { prompt: cards[req.params.id].question, hint: cards[req.params.id].hint }); });

module.exports = router; ```