I am writing a NodeJS based server- and client-side JavaScript application. I have Controllers, Models, Views and Presenters. The problem I am facing is that some parts of the code need to be only server-side, some client-side and some both.
For example, Controllers are pure server-side thing for me so they should not be available client-side. Presenters, on the other hand, are pure client-side thing so should be available in client-side.
Take a look at my current bad structure:
project\
project\public\index.js
project\public\images\
project\protected\controllers\
project\protected\models\
project\protected\views\
project\protected\presenters\
The problem I face is that public folder is the document root and protected is outside of the document root. I need to be able to use Views in both client- and server-side. So, my Views can't be in protected. The same applies to models and tons of other things. I need to be able to access them client-side too.
I am starting to think I have to put the entire structure under document root with the exception of some configuration file. Is this what I should do? Are there any problems with this approach? I am asking because most web frameworks (Django, Zend Framework) work the way that the framework is outside of the document root.