Node.js 和 Backbone.js 的集成

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15962121/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 14:11:48  来源:igfitidea点击:

Integration of Node.js and Backbone.js

javascriptnode.jsmongodbbackbone.jsexpress

提问by Will Piers

I have done considerable reading on both Node.js and Backbone.js; I've read some tutorials and done the relevant courses on Code School. I feel that I've got a pretty good idea of the functions that each technology serves in the context of a web application.

我对 Node.js 和 Backbone.js 都做了大量阅读;我已经阅读了一些教程并完成了 Code School 的相关课程。我觉得我已经对每种技术在 Web 应用程序上下文中提供的功能有了很好的了解。

My problem is that I don't really know how to integrate the two technologies and use them in tandem. I would really appreciate if someone could point me to a resource which goes through the entire development of an application using Node, MongoDB, and Backbone together.

我的问题是我真的不知道如何整合这两种技术并同时使用它们。如果有人能指出我使用 Node、MongoDB 和 Backbone 来完成整个应用程序开发的资源,我将不胜感激。

Many thanks

非常感谢

回答by Brad Harris

This is a good tutorial that shows how to setup that entire stack.

这是一个很好的教程,展示了如何设置整个堆栈。

http://backbonetutorials.com/nodejs-restify-mongodb-mongoose/

http://backbonetutorials.com/nodejs-restify-mongodb-mongoose/

In short...

简而言之...

Node.js

节点.js

You can use a library like restifyto provide a restful API for your client-side Backbone application. It can also serve your static assets for your Backbone application. The example uses restify, but could be accomplished with other libraries like express.

你可以使用像restify这样的库来为你的客户端 Backbone 应用程序提供一个安静的 API。它还可以为您的 Backbone 应用程序提供静态资产。该示例使用 restify,但可以使用其他库(如express )来完成。

Mongoose

猫鼬

Mongooseis a javascript abstraction layer for MongoDB. This provides an easy way to interact with MongoDB from Node.js.

Mongoose是 MongoDB 的 javascript 抽象层。这提供了一种从 Node.js 与 MongoDB 交互的简单方法。

Backbone

骨干

Your Backbone application can utilize your restifynode.js backend to handle the model synchronization. You should have plenty of control to setup the routes via restifyin a way that makes Backbone happy.

您的 Backbone 应用程序可以利用您的restifynode.js 后端来处理模型同步。你应该有足够的控制权通过restify以让 Backbone 满意的方式设置路由。

回答by shelman

This ebook could be useful (it's on Backbone, but uses Node for the backend):

这本电子书可能很有用(它在 Backbone 上,但使用 Node 作为后端):

http://addyosmani.github.io/backbone-fundamentals/

http://addyosmani.github.io/backbone-fundamentals/

You also may want to look at this book:

你可能还想看看这本书:

http://www.amazon.com/Building-Node-Applications-MongoDB-Backbone/dp/1449337392

http://www.amazon.com/Building-Node-Applications-MongoDB-Backbone/dp/1449337392

回答by Doum

There is also Node Cellar Source.

还有Node Cellar Source

There is not much explanation about the code, but the app is simple enough to get started and understand the basics layouts of node / backbone

关于代码没有太多解释,但应用程序很简单,可以开始并了解节点/主干的基本布局

It is, i think, just between an 'Hello World' code and a full app.

我认为,它介于“Hello World”代码和完整应用程序之间。

回答by Pedro Bustamante

I use for ap in backbone yeoman https://github.com/yeoman/generator-backboneand you use it with node.js too

我在主干 yeoman https://github.com/yeoman/generator-backbone 中用于 ap,你也将它与 node.js 一起使用

回答by Connor Leech

create rest api: http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/

创建rest api:http: //coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/

code backbone on the client: http://coenraets.org/blog/2012/10/nodecellar-sample-application-with-backbone-js-twitter-bootstrap-node-js-express-and-mongodb/

客户端的代码主干:http: //coenraets.org/blog/2012/10/nodecellar-sample-application-with-backbone-js-twitter-bootstrap-node-js-express-and-mongodb/

the backbonetutorials.com restify one is out of date. It's best to use express, especially if you plan to do any authorization. It's also more widely used

这个backbonetutorials.com 重新确认一个已经过时了。最好使用 express,特别是如果您打算进行任何授权。它也被更广泛地使用

回答by pixel 67

This is a comprehensive tutorial on rolling your own blog with Nodejs, Mongodb and expressjs http://howtonode.org/express-mongodbIt's old but with a little effort you can get it to work and learn at the same time

这是一个关于使用 Nodejs、Mongodb 和 expressjs 滚动您自己的博客的综合教程 http://howtonode.org/express-mongodb它很旧,但只需稍加努力,您就可以同时使用它和学习

回答by pixel 67

I have found this to be the most up to date material on using Backbone.js with node http://amzn.to/1DygKlJ

我发现这是在节点http://amzn.to/1DygKlJ 中使用 Backbone.js 的最新材料