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

__ROLLER__ Angel
__ROLLER__ Angel
25,606 Points

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

Seth Kroger
Seth Kroger
56,413 Points

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.

__ROLLER__ Angel
__ROLLER__ Angel
25,606 Points

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

Seth Kroger
Seth Kroger
56,413 Points

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.

__ROLLER__ Angel
__ROLLER__ Angel
25,606 Points

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