my histrory on mvc frameworks is primarily in php (cakephp, yii) and some in .net. So since in meteor the controllers are typically exposed to the end user, I had some questions on how to structure apps in meteor.
Typically in php my router would point my url to a controller/action. /foo/bar/baz would load the foo controller calling the bar function passing baz as an argument. I do see routers I can do this with. But from my thinking and experience, I would have a lot of code I may not necessarily want the end user to see in the controllers. Should I try to move more of that logic to the models? or Something different. I suppose from my experience, having to use server/client/public directories is just a lot different to my normal way of thinking. So I just need to find a way of doing this that matches with meteor.
Typically, using php i would have root directories like so:
framework/
--/all the files for the framework i would use. meteor is setup from npm so I wouldn't really have this
app/
--/config/ # config files like database connections, and so on.
--/controllers/ # normally private, but in meteor is public. is there any benefit to having controllers available to the client? or could I put these in /server/ as well?
--/models/ # this would essentially be in the /server/ directory for meteor.
--/views/ # here would likely be all of my templates, separated by directories related to controllers/models. public
--/public/ # just like meteor, all of my public directories. in php, this is the only directory the end users can see.
best I can tell, the best way i can organize this in meteor is like so:
/controllers/ # since not in server/client, is available to both. do I need to do it like this? it seems like this is how meteor behaves like it is real time
/server/ # only available to server
--/models/
--/config/
/public/ # like normal
/templates/ # replaces views, available to both clients and server
Does this seem right? I just want to be able to secure my code logic so users have the least possible chances of messing things up or doing things they shouldn't. I'm sure its just very different so I just need to look at it from a different perspective. Also, in php anything in the <?php ?> tags are hidden as well. In meteor, using mustache, anything in the {{ }} brackets can still be seen in the html source. Which i suppose in a way I would want to hide as well.
Also as a note, the need/want to hide code is primarily for apps that i want to make closed source or for things I would make at work, which is all generally proprietary code. If I am making something open source, Obviously I am not nearly as worried about this issue.
I'm just looking for more insight oh how I should do this and if anyone has any input on another or better/node/meteor way of doing things.
Thanks.