node.js - Backbone.js 和 Node.js 有什么区别?哪个最好?

标签 node.js backbone.js

我感到有点困惑,有很多框架用于与 Node.js 相关的“东西”。有人能给我概述一下 Backbone.js 和 Node.js 之间有什么区别吗?哪个最好?提前致谢。

最佳答案

我在这里引用了几个来源:

首先,引用堆栈溢出问题 here :

Most of the things you listed are related only because they are written in or otherwise use JavaScript. Comparing them is much like comparing apples to oranges. It's like asking what the difference is between a Toyota Camry and a V6 engine. They are related, but do different things.

Node

Also known as Node.js, Node is the JavaScript environment on which we run our server-side JavaScript code. It is based on the V8 JavaScript engine. All of the JavaScript code you write, or install and run from packages from NPM, GitHub, etc. is executed by the Node runtime environment.

Backbone

Backbone can be likened to as a Model-View-Controller framework for JavaScript. I believe it was originally written for the browser; it helps keep your client-side JavaScript clean by implementing most common MVC patterns (as well as a couple other things), allowing you to more easily connect your client-side JavaScript to your server-side code.

另外,这是来自同一 question 的答案在知乎上。归功于 Drew Harry:

They're almost completely unrelated. Traditionally, Backbone.js is a client library and Node.js is a way to write server-side applications in Javascript. Backbone aims to be a model + view system for binding data models with DOM elements that represent that model visually in a web page. Backbone also provides Collections of Models, as well as a bunch of utility functions for synchronizing those models with their server-side representations.

Node.js is just the v8 Javascript run-time environment packaged with a standard library to do useful server-side things with Javascript. There are lots of packages designed for Node (check out npm for ways to easily install those packages, Backbone included) that extend it to do all sorts of interesting things. It's possible to use Backbone.js with Node.js, but Backbone isn't particularly designed with use on the server in mind.

如果您觉得 Material 有帮助,请前往并为上述答案投票。

关于node.js - Backbone.js 和 Node.js 有什么区别?哪个最好?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15542187/

相关文章:

javascript - 当函数返回对象数组时如何使用 Promise

javascript - 在 Backbone View 中使用函数

javascript - Bookshelf.js - 如何仅获取一个查询的 'hidden' 字段?

node.js - "dispatch()"是什么意思/做什么,为什么当我们有 .then() 和 .catch() 时使用它

node.js - 多个用户同时购买最后一个产品

javascript - Marionette 中的 Hook 后退按钮(onbeforeunload 不起作用)

javascript - 如何刷新主干应用程序中的页面

javascript - 如何获取带有集合和模型 ID 的 URL

javascript - Backbone、require.js 和 Youtube Javascript API

mysql - POST 表单数据到 Express App 成功,使用 sequelize 插入 MySQL 数据库