Reputation: 21
I am getting in nodejs development. Until now everything is perfect, I've got my nodejs server running using expressjs as backend framework but I've found a problem, all nodejs tutorials included expressjs create unique server.js file and my code is messing up. All rountimes and functions live there and that's why I want to create an MVC pattern for my backend but I don't know how. I've tried to create a nodejs module but I failed in trying.
Someone can tell me how do I construct an MVC structure in backend as my frontend (I'm using Backbonejs)?
Upvotes: 1
Views: 1783
Reputation: 276
Here is an example of MVC style controllers using express: https://github.com/strongloop/express/tree/master/examples/mvc?_ga=1.227384661.999716043.1382977119
This example was pulled form the FAQ page on expressjs.com. The documentation there is really quite good.
Edit: If you change your mind about MVC look at the "How should I structure my application?" section of the FAQ for examples of other patterns.
Upvotes: 2