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
David Hughes
5,063 PointsApp not being 'served'
I got everything setup, and was receiving the same error as the video: "Cannot GET /". I made the changes to the app.js
app.use('/', express.static('public'));
But when I refresh my page at http://localhost:3000/ nothing changes. There is a console error that says "Failed to load resource: the server responded with a status of 404 (Not Found). I have MAMP running, do I need to make some adjustments to get this to work?
Also when I just open the index.html inside of the public folder in the cloned repo, it doesn't work.
Jesus Mendoza
23,289 PointsJesus Mendoza
23,289 PointsHey David, add the following code
app.use('/public', express.static(__dirname + '/public'));This will tell the app that everytime it sees /public, it needs to look for resources at the path given (which is __dirname, the current directory where your main app is located, and /public). and then access the resources from