node.js、backbone、socketio 和express 以及coffee 脚本都可以一起使用吗?
我试图了解最新和最好的技术,并且很好奇所有这些不同的技术如何组合在一起。
是不是这样:
Nodejs 是一个 Web 服务器,backbone 只是一个运行在 Nodejs 上的框架?
那么SocketIO是一个与backbone一起工作的库吗?
实际的代码可以用coffescript编写,编译后将是javascript。
那快递呢?这个可以用吗。
请指出这些组件/框架是否不能协同工作等。
I'm trying to get an overview of what's latest and greatest, and was curious how all these different technologies fit together.
Is it like this:
Nodejs is a webserver, backbone is just a framework that will run on nodejs?
SocketIO is a library that works with backbone then?
And the actual code can be written in coffescript, which when compiled, will be javascript.
What about express then? Could this be used.
Please point out if these are components/frameworks that don't work together etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
是的,CoffeeScript 可以毫无问题地与 Node.js 一起使用。事实上,如果您使用默认的 Coffee 可执行文件,它就是 Node.js,您甚至不需要编译为 JavaScript 来运行它。
至于Backbone,它实际上是一个客户端库。您也可以在这里使用 CoffeeScript,但您需要将代码编译为 JavaScript,因为浏览器只识别 JS。您通常不会在 Node 中运行 Backbone.js。
至于 Express,它是一个 Node 框架,因此预计它可以在 Node.js 的服务器上工作。
因此,总而言之:
通信有帮助吗?
Yes, CoffeeScript will work with Node.js without problem. In fact, if you you use the default coffee executable, it is Node.js and you don't even need to compile to JavaScript in order to run it.
As for Backbone, it is really a client-side library. You can also use CoffeeScript here, but you need to compile the code to JavaScript since the browsers only know JS. You wouldn't typically run Backbone.js in Node.
As for Express, it is a Node framework, so it is expected to work on the server in Node.js.
So, in summary:
Does that help?
Node.js 是 JavaScript 的服务器端实现。
Express 是一个 Web 框架,位于另一个 Nodejs 模块 connect 之上。
CoffeeScript 可以作为模块安装到node.js,允许您直接执行coffeescript代码在 Node.js 中。
Backbone是一个客户端浏览器库,与node.js无关,可以可与任何服务器端 Web 框架一起使用。
Node.js is a server side implementation of javascript.
Express is a web framework that sits on top of connect, another nodejs module.
CoffeeScript can be installed as a module to node.js that allows you to execute coffeescript code directly in node.js.
Backbone is a client-side browser library that has nothing to do with node.js and can be used with any server-side web framework.
我对backbone一无所知,但zappa(http://zappajs.org/)是coffeescript + express + SocketIO的示例。
I know nothing about backbone but zappa (http://zappajs.org/) is the sample of coffeescript + express + SocketIO.
是的,事实上这里有一篇很棒的文章,展示了如何在后端重用你的backbone.js 模型。
http:// andyet.net/blog/2011/feb/15/re-using-backbonejs-models-on-the-server-with-node/
Yep, infact here is a great article showing how you can reuse your backbone.js models on the backend.
http://andyet.net/blog/2011/feb/15/re-using-backbonejs-models-on-the-server-with-node/
我不确定“表达”是什么,但你提到的其他所有内容都可以很好地配合。
有一个项目用使用 Socket.io 的实现来替换
Backbone.Sync
代码(这是对 Backbone 中后端服务器的所有调用的代码):https://github.com/ologicalparadox/backbone.iobind很多人用coffeescript 编写主干代码。您会在网络上找到很多这样的示例,包括 stackoverflow 上的此处。
希望有帮助。
I'm not sure what "express" is, but everything else you've mentioned plays well together.
there's a project to replace the
Backbone.Sync
code (which is what does all of the calls to the back-end server in Backbone) with an implementation that uses Socket.io: https://github.com/logicalparadox/backbone.iobinda lot of people write backbone code in coffeescript. you'll find a lot of examples of that around the web, including here on stackoverflow.
hope that helps.