Node - Express + Ember + Socket io project file structure for MVC development

So, I recently started getting node and started working on several projects using the Express framework . I like it - I really like the syntax as an interactive jQuery developer.

However, from the point of view of the file structure of the project, I seem ignorant and, apparently, I am, perhaps, bloating things for reasons.

I have a basic project template on github: https://github.com/KingScooty/node-express-3.0-html5-boilerplate , which works pretty well for me.

And now I want to integrate Ember.js . However, I do not know how to structure directories. I think something like this:

project β”œβ”€β”€ app β”‚  β”œβ”€β”€ collections β”‚  β”œβ”€β”€ models β”‚  └── views β”œβ”€β”€ node_modules β”œβ”€β”€ public β”‚  β”œβ”€β”€ css β”‚  β”œβ”€β”€ img β”‚  └── js β”œβ”€β”€ routes └── server β”œβ”€β”€ environment └── logs 

Socket io settings are included in the server folder along with all the server configuration and node environment configuration settings (development / production / production). Static files and jQuery go publicly, and the goodwill of MVC applications is included in the application folder.

But this does not seem correct if the shared folder is separated from the application folder. Not to mention how I even included various JS files in the MVC folder structure.

(Front MVC development is something that I know very little about, but this is what I am trying to learn, and also trying to integrate it into a node environment)

If someone can point me to the right way to develop MVC front end using the back end of node / socket io which would be evil!

Greetings.

-S

+4
source share
2 answers

So, with regard to Express, it is that it does not really apply any structure to your code. This is a kind of mixed blessing. This is great for simple things like the JSON API, but then it gets more complicated when you start to understand the whole MVC infrastructure and user interface.

The following message may help you.

Personally, I would suggest taking a look at Geddy and Railwayjs (now called CompoundJS ). Both of these attempts provide some additional structure for the whole process.

You can also see a more detailed list here .

+6
source

Sails.js is the MVC framework for node, which has the unique difference of RESTfully routing Socket.io messages just like your Express routes.

It also comes with a Mast interface component. Mast provides similar functionality for Meteor, as it allows you to talk directly to the database from the client. If you need to provide more complex functions, you simply add a controller to the server.

More details here: https://github.com/balderdashy/sails

+10
source

Source: https://habr.com/ru/post/1411955/


All Articles