3 ms·
Express is very flexible, and can work in just about any way you could imagine. Take no offense but it sounds like you aren't very familiar with javascript or n
by chapel 15y ago
Express is very flexible, and can work in just about any way you could imagine. Take no offense but it sounds like you aren't very familiar with javascript or node.js and that is okay, but there is much to learn about project organization.
It is actually quite easy to organize your code similar to a rails mvc application, the key is being consistent.
If you want to see a working example of an mvc style express application, then look at the examples provided with express: https://github.com/visionmedia/express/tree/master/examples/mvc https://github.com/visionmedia/express/tree/master/examples/...
Again, there are many ways to organize your applications, just look around at what other people have done, or use the examples, and you should be able to make yours handle just the same.
- Vitaly 15y agoThis is one of the things that Rails gets right. There is no real need to be creative here. Rails just comes with a default layout built in, no need to 'choose your own' for the 'own' sake. It doesn't, btw, mean that you can't use your own, just in this case you'll need to add the relevant directories to the path yourself. The standard layout and built in generators are just brilliant.
- chapel 15y agoOf course it is a matter of opinion, but you have to keep in mind that node itself isn't a framework like rails, and express while similar to sinatra with declaring routes is very un-opinionated about how it handles things. That is one reason I enjoy using node and a lot of the modules and add-ons created for node, giving me the freedom to do what I want from the start and not fight against the 'right' way the creators intended.
- Vitaly 15y agothis is a common misconception about rails. Rails doesn't "force" you to use their way. You don't have to call your table "people" if your model is called "person". It just that you have additional freedom not to configure anything if you are ok with the default configuration. in many other frameworks you always have to configure everything, abut in rails you might just go with the defaults and skip the configuration altogether. If express had code generators that would generate standard layout for models etc it wouldn't hurt anyones' ability to use their custom layout.
- tjholowaychuk 15y agorails apps are also very large, making them annoying/difficult to bundle up with other modules such as the nodejs Kue module which uses express for the UI. Rails modularity is quite terrible, Drupal does this much better, but yes you have to be creative with Express, which is only difficult if you're not creative. Application requirements are significantly different, myself and many others prefer a "start small" approach vs the "start huge" approach.