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 Serving Static Files in Express Adding Static Assets to the App

Not sure how to use the files from the teacher notes with my application

I downloaded the files from the teacher notes, and I wasn't sure what to do with them, so I moved the folder into my flashcards folder, and I used app.use(express.static("/js-express-basics-flashcard-assets/js-express-basics-flashcard-assets/public")). When I go to http://localhost:3000/stylesheets/style.css, it returns the not found error, Flash Cards Not Found 404 Error: Not Found at C:\Users\babyoscar\flashcards\app.js:20:17 at Layer.handle [as handle_request] (C:\Users\babyoscar\flashcards\node_modules\express\lib\router\layer.js:95:5) at trim_prefix (C:\Users\babyoscar\flashcards\node_modules\express\lib\router\index.js:317:13) at C:\Users\babyoscar\flashcards\node_modules\express\lib\router\index.js:284:7 at Function.process_params (C:\Users\babyoscar\flashcards\node_modules\express\lib\router\index.js:335:12) at next (C:\Users\babyoscar\flashcards\node_modules\express\lib\router\index.js:275:10) at C:\Users\babyoscar\flashcards\node_modules\express\lib\router\index.js:635:15 at next (C:\Users\babyoscar\flashcards\node_modules\express\lib\router\index.js:260:14) at Function.handle (C:\Users\babyoscar\flashcards\node_modules\express\lib\router\index.js:174:3) at router (C:\Users\babyoscar\flashcards\node_modules\express\lib\router\index.js:47:12) An app to help you study I'm not sure what to do with the files. Can someone help? Thanks.

1 Answer

You only need to put the name of the folder, not the whole path to the folder.