如何搭配前press.js(node.js中)和Backbone.js的之间的意见(HTML + CSS + JS) [英] how to mix views (html+css+js) between express.js (node.js) and backbone.js

查看:163
本文介绍了如何搭配前press.js(node.js中)和Backbone.js的之间的意见(HTML + CSS + JS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始学习前press.js(对Node.js的)和Backbone.js的。我已经研究了大量的文档和教程的,但也有一些细节我还没有逮住了,并没有与之相关的信息。我希望有人能帮助这里:

I am starting to learn Express.js (for Node.js) and Backbone.js. I have researched lots of documentation and tutorials, but there are some details i still haven't catched up, and there is no information related to it. I hope somebody could help here:

我的一个最大的问题是意见。我了解,你可以在你的Backbone.js的app.js建立你的MVRC,你的MVC上的前press.js应用,如何在坚持通过JSON后端(如preSS),采用Socket。 IO的实时性,等等。但是,你怎么设计的看法?

One of my biggest issues are the VIEWS. I understand how you can build up your MVRC in your backbone.js app.js, your MVC on your Express.js app, how to persist on the backend (express) via JSON, using Socket.io for real time, etc. But, how do you design VIEWS?

这两个框架提供了自己的看法,但很明显,如果你正在使用Backbone.js的,是因为你想建立在客户端与骨干网的意见(HTML,CSS,jQuery和JS),而不是防爆preSS(玉和模板)。如果你使用防爆press.js是因为它提供了比Node.js的更多的工具,如身份验证,会话控制,数据库等。

Both frameworks offer their own VIEWS, but is obvious that if you are using Backbone.js, is because you want to build up the VIEWs on the client side (HTML,CSS,jQuery and JS) with Backbone, and not with Express (Jade and templating). And if you use Express.js is because it offers more tools than Node.js, like authentication, session control, data base,etc.

你怎么混起来?我已经看到互联网上的一些例子喜欢这本书(O'Reilly Media公司):

How do you mix it up? i have seen some examples on internet like this book (O'Reilly Media):

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

具体而言,对他们的GitHub源$ C ​​$ C与选项7的TodoList的应用程序。

specifically, on their github source code related to "option7" for a TodoList app.

在这里,他们混淆了这两种技术(Backbone.js的和Ex press.js用的MongoDB)。他们这样做的客户端和服务器连接的Redis等,之间的数据持久性,但我仍然不明白为什么他们使用玉和/视图对防爆press.js主HTML模板,但CSS,jQuery和/公共内的图像上Backbone.js的。

Here, they mix up both technologies (Backbone.js and Express.js with MongoDB). They do data persistant between client and server, connection to Redis, etc, but i still don't understand why they use Jade and /views for main HTML templating on Express.js, but CSS, jQuery and images inside /public on Backbone.js.

我们不应该建立在HTML5,CSS3和JS完全Backbone.js的?通过什么/ ROUTES从后端inyecting HTML模板的点,如果你想在前端所有的MVC?

Shouldn't we build up the HTML5,CSS3 and JS entirely in Backbone.js? Whats the point of inyecting HTML templates from the backend through /ROUTES, if you want all your MVC on the front-end?

非常感谢你,希望能得到一个答案: - )

thank you very much and hope to get an answer :-)

推荐答案

我的一个最大的问题是意见。我了解,你可以在你的Backbone.js的app.js建立你的MVRC,你的MVC上的前press.js应用,如何在坚持通过JSON后端(如preSS),采用Socket。 IO的实时性,等等。但是,你怎么设计的看法?

在Ex press.js的观点是可以被渲染并返回到通过HTTP客户端/浏览器的模板。

The views in Express.js are templates which can be rendered and returned to the client/browser through HTTP.

你怎么混起来?

您有一个客户端和服务器端不知道你的意思混合起来的东西。如果您的浏览器需要数据,您可以使用对服务器的请求得到它。

You have a client-side and a server-side not sure what you mean with mix it up. If your browser needs data you can get it with a request to the server.

我们不应该建立在HTML5,CSS3和JS完全Backbone.js的?

大多数时候,你会的。

请告诉我通过/ ROUTES从后端inyecting HTML模板,如果你想点你所有的MVC的前端?

这是大部分,所以你不必重新渲染整个页面,但只是一部分也加快网页。

This is mostly to speed up web pages so you don't have to re-render the entire page but only a part.

这篇关于如何搭配前press.js(node.js中)和Backbone.js的之间的意见(HTML + CSS + JS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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