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 trialKevin Ohlsson
4,559 PointsHow does prompt variable in CARD.PUG know were the variable resides?
Hello
I dont understand Andrews (author) explaination of how the prompt variable in the pug template card.pug finds its variable.
https://expressjs.com/en/4x/api.html#res.render Documentation says: "The view argument is a string that is the file path of the view file to render."
app.get('/cards', (req, res) => { // creates url /CARDS
res.render('card', {prompt: "what the"}); // what does CARD mean here?
})
1 Answer
Kevin Ohlsson
4,559 Pointsi think i get it...
app.get('/cards', (req, res) => { // creates url /CARDS
res.render('card', {prompt: "what the"}); // uses the pug file card and bridges app.js prompt with its call in the pug template
})