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 trialTrino Mitra
11,165 PointsIS "module.exports = require('./lib/express');" valid? It was prewritten in the index.js file.
Following the same steps as the video, the preloaded file looked like
'use strict';
module.exports = require('./lib/express');
1 Answer
Michael Hulet
47,913 PointsYes, that should be valid JavaScript, assuming there's a file called "express.js
" at the path /lib/
relative to the directory that file is in. What that command would do is go get all the things in (this file's path)/lib/express.js
, and then it would tell JavaScript "Hey, when someone else asks for the code in this file using the require
function, give them all of this code"