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 trialPeter Lu
10,612 PointsWhy can you do require('./routes/cards') and not require('./routes/cards.js')?
Do you never need the file extension?
1 Answer
Leopold Lucas
17,236 PointsI think this is because it assumes that is a javascript file by default
Neil McPartlin
14,662 PointsNeil McPartlin
14,662 PointsAgreed. And if you try
require('./routes/cards.js')
, this does work too but the extension just isn't needed.