Reputation: 5034
I'm using Node.js/Express to create a web app. By default the views are kept separate from the public folder. I understand that this is because these files might not always be static, i.e. when using Jade templating. However, in the case that my .html files will always be static, is it appropriate to include them in the public directory along with javascript, images, and css?
Upvotes: 1
Views: 165
Reputation: 33650
It is generally discouraged to redistribute revision-controlled sources in your public directory.
This would force you and your clients back to using ETag for proper caching, you would miss out on building them for production (versioning, minification) and you'll prevent your developers from being able to add comments because these aren't stripped--or worse, imagine someone adds a publicly inappropriate comment, pushes it into production and yikes now it's retained somewhere on the internets forever and ever!
Upvotes: 1
Reputation: 191729
If your HTML is static (i.e. the server does not need to do any processing on it) and the user should be able to make direct requests to see it it is appropriate to put it in public
or wherever you are serving static data from.
If you didn't do this, you would have to create routes in express that served the static data from these files explicitly. This would be an extra step with no benefit.
Upvotes: 1