的NodeJS /导轨/骨干架构 [英] Nodejs/rails/backbone architecture

查看:125
本文介绍了的NodeJS /导轨/骨干架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我的建筑,非常喜欢的作品,但Craigslist网站功能有限。我一般会使用Rails使用这种应用程序,但我在学习的NodeJS / backbonejs框架很感兴趣,它看起来这是一个很好的机会,把它捡起来。

I have an app that I'm building which very much works like craigslist but with limited functionality. I generally would use Rails for this kind of app but I'm interested in learning nodejs/backbonejs framework and it seems like this is a good opportunity to pick it up.

我不知道的NodeJS和/或backbonejs如何适应这个解决方案?我不一定要使用滑轨,我很好用和的NodeJS如果backbonejs是有道理的。

I'm not sure how nodejs and/or backbonejs fits in this solution? I don't necessarily have to use rails, I'm fine with using nodejs and backbonejs if that makes sense.

感谢

推荐答案

您当然可以使用Node.js的或者Rails或两者与Backbone.js的 - 我已经使用了所有或这些技术的组合栈和他们都是伟大的。挑选哪些使用应取决于你正在建设什么,并在较小程度上,你的舒适度,每个技术。

You certainly can use Node.js or Rails or both with Backbone.js - I have used stacks with all or combinations of these technologies and they are great. Picking which ones to use should depend on what you are building and to a lesser extent, your comfort levels with each technology.

替换为节点
滑轨
Node.js的可随意更换的Rails的功能,即说话的数据库,包含模型逻辑,提供网页和资产,控制路由。有吨吨的模块使用这一点。一个常见的​​解决方案是使用防爆preSS(一个简单的西纳特拉类型的网络框架)担任网页和处理模板和ODM / ORM来处理数据库对象。也有更广泛的铁轨般的框架,如Geddy。

Replacing Rails with Node
Node.js can easily replace the functionality of Rails, i.e. talking to the database, containing model logic, serving pages and assets and controlling routing. There are tons of tons of modules available for this. A common solution is to use Express(a simple Sinatra type web framework) to serve pages and handle templating and an ODM/ORM to handle database objects. There are also more extensive rails-like frameworks such as Geddy.

我拿在节点作为直接替代的Rails

如果您只是想了Rails的功能,请使用Rails的。的Ruby / Rails code看起来更清洁,在我看来更易于管理,这是一个比较成熟的(随意火焰... 的)。如果你是服务于很多不同的网页,Rails会组织的事情做好。不过,如果你正在一个单页的应用程序,这是主要的用例骨干之一,那么多的Rails的包是不必要的 - 你只需要在模型逻辑与数据库交互。在这种情况下,像前preSS(节点)或西纳特拉(红宝石)与背部和前端将sufice之间通信的ORM和RESTful路由。

My take on Node as a direct replacement for Rails
If you simply want the functionality of Rails, use Rails. Ruby/Rails code looks cleaner and is more managable in my opinion and it is a bit more mature (feel free to flame...). If you are serving a lot of different pages, Rails does a good job of organizing things. However, if you are making a single page app, which is one of the main use cases for Backbone, then much of the Rails package is unnecessary - you just need the model logic and database interaction. In this case, something like Express(Node) or Sinatra(Ruby) with an ORM and RESTful routing for communicating between back and front end will sufice.

添加与节点
更引人注目的用例的节点是带有实时或多人方面的网站;节点是伟大的并发和asynchronousity。如果您的客户端无需重新加载页面或数据发送数据到对方从服务器推送到客户端,而不另一个页面负载(一个伟大的模块,这样使用Node是的 Socket.io )。再次,这是一个以单页或高交互界面,骨干迎合行之有效的用例。

Added functionality with Node
The more compelling use cases for Node are for sites with real time or multiplayer aspects; Node is great for concurrency and asynchronousity. Use Node if you have clients sending data to each other without reloading pages or data being pushed from server to client without another page load (a great module for doing this is Socket.io). Again, this is a use case that works well with single page or high interaction interfaces that Backbone caters to.

这篇关于的NodeJS /导轨/骨干架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆