admin管理员组文章数量:1186686
I've been using backbone recently as my client-side framework. On the server I use Express.js. Still, I was reading about Meteor and realized that it was a rather interesting 'full-stack' framework.
Is the usage of Backbone and Meteor complementary, or with Meteor can one simply ditch Backbone (or any other MV*)?
I've been using backbone recently as my client-side framework. On the server I use Express.js. Still, I was reading about Meteor and realized that it was a rather interesting 'full-stack' framework.
Is the usage of Backbone and Meteor complementary, or with Meteor can one simply ditch Backbone (or any other MV*)?
Share Improve this question edited Dec 15, 2013 at 9:29 JJJ 33.2k20 gold badges94 silver badges103 bronze badges asked Nov 10, 2012 at 15:12 tUrG0ntUrG0n 4,4483 gold badges22 silver badges27 bronze badges2 Answers
Reset to default 27That's right. The different parts of Meteor like Meteor.Collection
(the Mongo database API that also works on the client) and Template
(the Handlebars style templates that automatically redraw when data changes) work together. So any time one user makes a change, all the other tabs that are allow access to that data will automatically redraw. If you're using them, then you don't need a separate library like backbone on the client.
Backbone is built for an earlier style of application, where you have separate client and server code written with different APIs. In that model, the server side exposes a REST API and backbone's job is to provide some structure on the client for how to query that API and draw the screen based on the data that comes back. But you still have to write all the data synchronization and model validation code by hand before you have a realtime app, and you have to do it twice: once on the client and once on the server.
There's one exception: many of us do use backbone's router in our Meteor applications. The code below is from the Todo List example.
////////// Tracking selected list in URL //////////
var TodosRouter = Backbone.Router.extend({
routes: {
":list_id": "main"
},
main: function (list_id) {
Session.set("list_id", list_id);
Session.set("tag_filter", null);
},
setList: function (list_id) {
this.navigate(list_id, true);
}
});
Router = new TodosRouter;
Meteor.startup(function () {
Backbone.history.start({pushState: true});
});
There is an existing meteorite smart package called meteor-router. Perhaps it can help you migrate your existing backbone code.
本文标签: javascriptAre meteorjs and backbonejs complementaryStack Overflow
版权声明:本文标题:javascript - Are meteor.js and backbone.js complementary? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738312102a2074104.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论