Does node.js, backbone, socketio and express and coffee script all go together?

[亡魂溺海] 提交于 2019-12-22 10:06:33

问题


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.


回答1:


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:

  • You'd use Node server-side with SocketIO and Express
  • CoffeScript can go client and server
  • You would use Backbone on the client
  • You would likely use a Backbone.sync mechanism for talking from Backbone models to SocketIO on the server

Does that help?




回答2:


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.




回答3:


I know nothing about backbone but zappa (http://zappajs.org/) is the sample of coffeescript + express + SocketIO.




回答4:


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/




回答5:


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.iobind

a 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.



来源:https://stackoverflow.com/questions/7661959/does-node-js-backbone-socketio-and-express-and-coffee-script-all-go-together

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!