I have a small pet project which is a single-page application (Node.js + express.js + EJS views) which also includes client-side javascript. I've started the back-end part of the project structure using a straight-forward project structure, comprised of a ./src
structure bundling all server-side javascript and a ./public
structure to serve all the static bits. However, it't not clear to me how the client-side javascript should fit in this project structure.
Other stackoverflow questions on Node.js, such as this one, suggest that the server-side code should be stored in ./lib
and the client-side code in ./app
but to me it doesn't make sense to refer to server-side code as library code. Other sources, such as non-authoritative blog posts, replace ./lib
with ./server
and call it a day. However, that doesn't look like an improvement.
As the client-side javascript is served alongside EJS views it doesn't make much sense to split the project into server-side and client-side projects.
With this in mind, what's the best way to organize a project structure for a single-age application based on Node.JS+EJS+template views?