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 Express Basics (2015) Developing Express Apps Like a Boss Adding Routes to the App

Did you also have to comment out use strict; to get the /blog route to show the posts?

If I don't comment out use strict I get a reference error that posts is not defined. FYI My project is inside the Projects folder of my workspace: https://w.trhou.se/jxez3wa37f

2 Answers

I believe with 'use strict'; you have to use var (or it's ES6 equivalents) to declare all variables the first time and you left it off when declaring posts.

True, it works now. Houston did it without the var keyword in the video.

If you go back and check, you'll see he uses a comma after the first require instead of a semi-colon. That makes the two variables part of the same var statement.

I didn't notice that! Thanks for the heads up.