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 trialAllison Walker
17,137 PointsWhy are we using '/static' - as opposed to '/public'?
Curious as to why we use '/static' vs any other term, especially '/public'?
3 Answers
Andrew Chalkley
Treehouse Guest TeacherI haven't seen this particular video but static
and public
are both common directories for "static assets" or "publicly accessible assets".
Anthony c
20,907 PointsIs there an upside to passing the files through "/static"?
Why not just name the "public" folder "static" to begin with?
why this?
app.use('/static', express.static(__dirname + '/public'))
and not this
app.use(express.static(__dirname + '/static'))
Matthew Day
6,740 PointsI would love to know the answer to this, as well.
davidanguiano2
6,859 Points.static is built in middleware for Express.js. So using /static directory to store all your static asset files is -- although extremely helpful -- simply a naming convention.
In the context of the massive info dump that comes with inevitably distilling a complex toolset into a few short videos, this can seem like just one more little thing to remember.