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 Merging the Design Files

James Fleming
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
James Fleming
Full Stack JavaScript Techdegree Graduate 15,848 Points

Wanted to see if this is only me accessing my images like this..

In the video, he mentioned that we can access the images in the public folder by referencing /static to start the file path, then continuing into the folder. So like this: /static/img/close.svg. When I do it like that, i receive an error and the image doesn't show. However, if I remove the /static part and just type the following: /img/close.svg it fixes the problem and adds the image to the browser. Did anyone else experience this? Is this wrong? Thank you!!

1 Answer

Jelena Feliciano
seal-mask
.a{fill-rule:evenodd;}techdegree
Jelena Feliciano
Full Stack JavaScript Techdegree Student 12,729 Points

You might be receiving that error message because the img file may not have been saved in the public file. I made the same mistake and was going to do what you decided until the lightbulb went off after watching the video for the millionth time. As with anything in coding, there are many ways to accomplish one task, so if it works, I'd say go with it.