Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC with node.js: expressjs, backbonejs, railwayjs

I'm going to build an app using a lot of interfaces for the user to insert data which should be stored in a database. I developed applications in PHP before using Symfony2. Now I want to use node.js but I'm not sure what to use expressjs, backbonejs, railwayjs. For the application I need a MVC structure, form validation and a good database ORM. Which of these 3 should I use? What's the main different between these?

like image 315
dplusm Avatar asked Feb 17 '12 18:02

dplusm


2 Answers

If you coming from rich framework like Rails or Symfony your choise is RailwayJS, but if you like something minimal and not well-structured, use ExpressJS.

What's the main different between these

RailwayJS is extended ExpressJS with routing, controllers, localization, generators, rich logging, ORM and other stuff built in, right over expressjs. But in general you can use it in the same way as express: middlewares, express routes, tests, etc. So you can use any middleware written for express/connect, you should just put it in proper place (config/environment.js for common env, or config/environments/{development|production}.js for env-specific.

like image 139
Anatoliy Avatar answered Nov 05 '22 09:11

Anatoliy


Express is becoming more or less the de facto choice for web development framework. You can totally do MVC development with it, the view being your templating engine (jade, for example), the model being provided by your ORM (mongoose is an excellent choice should you go with MongoDB), and your route handlers/app logic/middleware being the controller.

Backbone provides MV* structure for your client-side development, so it is complementary to (and independent of) whatever server-side framework or library you choose. There are many options for client-side MVC or MVVM code organization, such as knockout.js and ember.js, but personnally I prefer Backbone, which has less magic but offers more control. This is relatively subjective, though, so this is not really a relevant debate for stack overflow.

like image 38
mna Avatar answered Nov 05 '22 08:11

mna