So i've recently started getting into node, and have started working on a few projects using the Express framework. I love it - the syntax really appeals to me, being an interactive jQuery dev.
However, in terms of a project file structure, i seem to be clueless and appear to be, perhaps, bloating things out of proportion.
I've got a basic project boilerplate over on github: https://github.com/KingScooty/node-express-3.0-html5-boilerplate that works for me quite nicely.
And now i'm looking to integrate Ember.js. However, i have no idea how to structure the directories. I'm thinking something along the lines of this:
project
├── app
│ ├── collections
│ ├── models
│ └── views
├── node_modules
├── public
│ ├── css
│ ├── img
│ └── js
├── routes
└── server
├── environment
└── logs
Socket io settings go in the server folder, along with all the node server config and environment config settings (development / staging / production). Static files and jQuery go in public, and the MVC app goodness goes in the app folder.
But it doesn't feel right having a public folder separate from the app folder. Not to mention how i'd even go about including the various JS files in the MVC folder structure.
(Front end MVC development is something i know very little about, but this is what i'm trying to learn while also trying to integrate it into my Node environment)
If someone can point me on the right path for front end MVC development while utilising a node / socket io powered back end, that would be wicked!
Cheers.
-S
Sails.js is an MVC framework for node that has the unique distinction of RESTfully routing Socket.io messages in the same way as your Express routes.
It also comes bundled with a front-end component, Mast. Mast provides similar functionality to Meteor, in that it allows you to talk directly to the database from the client. If you need to provide more complex functionality, you just add a controller on the backend.
More here: https://github.com/balderdashy/sails
So the thing about Express is that it doesn't really enforce any kind of structure on your code. This is kind of a mixed blessing. It's great for simple things like a JSON API, but then it becomes more complex when you start to deal with a whole MVC framework and UI.
The following post may help you.
Personally, I would suggest taking a look at Geddy and Railwayjs (now called CompoundJS). Both of these attempt to provide some extra structure to the whole process.
You can also take a look at a more extensive list of options here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With