Backbone.js 前端和 RESTful Rails 后端? [英] Backbone.js frontend with RESTful Rails backend?

查看:25
本文介绍了Backbone.js 前端和 RESTful Rails 后端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Web 开发领域开始使用 PHP,然后是最近几年的 Rails.从那时起,我一直在 Rails 中完成我所有的 Web 项目.

I started in the web development world with PHP, and then Rails in the recent few years. Since then I've been doing all my web projects in Rails.

最近似乎有一种趋势,将 Rails 制作为纯 RESTful 后端服务,并使用 Backbone.js 等前端框架进行所有前端交互.我想知道你们对此有何看法?这会是最终的未来吗?

Recently there seems to be a movement towards making Rails as a pure RESTful backend service and using frontend framework such as Backbone.js for all frontend interaction. I'm wondering what's you guys' take on it? Will this be the eventual future?

此外,除了 Backbone.js,还有哪些其他替代方案可以用于此目的的前端框架?

As well, besides Backbone.js, what are some other alternatives for frontend framework for this purpose?

还假设我希望同时支持我的应用程序的桌面版本和移动版本,这是否是正确的选择?所以我会有一个带有不同前端服务的后端服务吗?这样我就不需要管理 Rails 端的所有视图了?

Also assuming that I will want to support both a desktop version and a mobile version of my app, would this be a proper route to take? So I'll have a single backend service with different frontend services? This way I don't need to manage all the views on Rails' side?

谢谢!

推荐答案

对于客户端框架,本文列出了其中的 20 个框架,并有优缺点:http://net.tutsplus.com/文章/网络综述/20-javascript-frameworks-worth-checking-out/

For Client-side frameworks, this article has a list of 20 of them with pro's and con's: http://net.tutsplus.com/articles/web-roundups/20-javascript-frameworks-worth-checking-out/

这是列表:

  1. Backbone.js
  2. Knockout.js
  3. Asana luna
  4. 卡布奇诺
  5. Sproutcore
  6. BatmanJS
  7. corMVC
  8. TrimJunction
  9. pureMVC
  10. jamal
  11. choco
  12. sammyjs
  13. extJS
  14. agilityJS
  15. 眼球
  16. activejs
  17. spinejs
  18. qooxdoo
  1. Backbone.js
  2. Knockout.js
  3. Asana luna
  4. Cappucino
  5. Sproutcore
  6. BatmanJS
  7. corMVC
  8. TrimJunction
  9. pureMVC
  10. jamal
  11. choco
  12. sammyjs
  13. extJS
  14. agilityJS
  15. eyeballs
  16. activejs
  17. spinejs
  18. qooxdoo

这些大致都是关于创建客户端、基于 ajax 的 javascript MVC 框架.

These are roughly all about creating client-side, ajax-based, javascript MVC frameworks.

如果您想从某个地方开始,那么我建议您考虑 客户端模板 (...ates...ates...ates)(只是V")支持面向服务的架构(您创建的服务端点支持许多客户端).

If you're looking to start somewhere, then I recommend thinking about Client-Side Templates (...ates...ates...ates) (just the "V") to support a service-oriented architecture (many clients are supported by service-endpoints you create).

这是一种新技术,涉及模块化客户端代码,将 MVC 引入客户端,并让业务逻辑存在于平台中.许多软件即服务应用程序都在利用它们,并且随着 javascript 库和框架的日益复杂,以及具有 HTML5、CSS3 等的浏览器功能,客户端呈现的复杂性将会越来越高.

It's a new technique that involves modularizing your client-side code, bringing MVC to the client, and let business-logic live in the platform. A lot of Software-as-a-Service applications are leveraging them, and with the increasing sophisticated of javascript libraries and frameworks, as well as browser capabilities with HTML5, CSS3, etc. there's going to be an increasing sophistication in client-side presentation.

那就学吧.

有什么好处?

解释 Linked In:用于利用浏览器缓存、解耦前端客户端呈现、异步加载、渐进式渲染(对于某些框架)、性能、ajax 交互等.

To paraphrase Linked In: for leveraging browser-caching, de-coupling your front-end client-side presentation, asynchronous load, progressive rendering (for some frameworks), performance, ajax-interaction, and more.

几个很棒的框架包括:

  1. 小胡子
  2. dust.js
  3. 车把
  4. Google 闭包模板
  5. 修女
  6. Mu
  7. 风筝

我强烈建议您查看 LinkedIn 从 JSP 转向客户端模板 以及为什么他们在 Linked In 的前端客户端模板抛出 进行比较.他们更详细地研究并研究了为什么要更改堆栈以支持这一点(这涉及使用 3 种服务器端技术),以及他们对所有可以找到的框架的比较.

I highly recommend looking at Linked In's move away from JSP towards Client-Side Templates and why they choose dust.js in Linked In's front-end client-side templates throwdown for a comparison. They go into much greater detail, and research, as to why they changed their stack to support this (it involved using 3 server-side technologies), as well as their comparisons of all the frameworks they could find.

这篇关于Backbone.js 前端和 RESTful Rails 后端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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