是否有一个框架,允许我定义只有一次的模式? [英] Is there a framework that allows me to define a model only once?
问题描述
我刚刚完成了创建多个模型和一个必须单独写所有的属性1)一个Rails的ActiveRecord 2)Rails的数据库迁移,以及3)Backbone.js的典范。我不觉得很干。我认为在干涸这个问题会切换到Node.js的,我可以在背部和前端(最好重复使用同一型号Backbone.js的),但对于数据库架构使用CoffeeScript的第一步?我知道我可以创建一个从模型的属性生成SQL的框架,但在此之前我走上了这方面的努力,我想,如果这样的事情已经存在或正在开发中。
I just finished creating several models and a had to separately write all of their attributes in 1) a Rails ActiveRecord 2) a Rails database migration, and 3) a Backbone.js model. I'm not feeling very DRY. I assume the first step in DRYing up this problem would be to switch to node.js where I can use CoffeeScript on the back and front end (ideally reusing that same Backbone.js model), but what about the database schema? I realize I can create a framework that generates SQL from model attributes, but before I embark on that endeavor I was wondering if something like this already exists or is in development.
这也将是真棒,如果这个框架可以统一视图和控制器,使我没有应用程序/视图,应用程序/控制器,应用程序/资产/ JavaScript的/视图,应用程序/资产/ JavaScript的/路由器等所有定义在不同的地方类似的事情。
It would also be awesome if this framework could unify views and controllers so that I don't have app/views, app/controllers, app/assets/javascripts/views, app/assets/javascripts/routers, and the like all defining similar things in different places.
推荐答案
查看德比,使Node.js框架积极发展,它试图统一视图和控制器(以及更多):
Check out Derby, a node.js framework under active development, which tries to unify views and controllers (and a lot more):
[德比]运行在服务器和浏览器相同的code,并同步数据
自动。德比负责模板的渲染,包装,和
模型 - 视图绑定开箱。由于所有功能旨在
齐心协力,没有code复制和胶水code是必要的。
[Derby] runs the same code in servers and browsers, and it syncs data automatically. Derby takes care of template rendering, packaging, and model-view bindings out of the box. Since all features are designed to work together, no code duplication and glue code are needed.
我在建设有德比的小嗜好应用程序,到目前为止,它一直乐趣和心灵挑战。统一的新的世界有它自己的物理..
I'm building a small hobby app with Derby and so far it's been fun and mind-challenging. A unified new world has its own physics..
有一点要注意的是德比是建立在赛车,一个实时模型顶部同步引擎;你会发现它重如果你希望像光胶code,它缝合在一起Backbone.js的,当然preSS和一些数据库层。
One thing to note is Derby is built on top of Racer, a "realtime model synchronization engine"; you may find it 'heavy' if you were expecting something like a light glue code that stitches together Backbone.js, express and some database layer.
修改:我还没看着密切其他框架:
Edit: other frameworks I haven't yet looked into closely:
- 流星(node.js的)
- ClojureScript 之一(ClojureScript)
- meteor (node.js)
- ClojureScript One (ClojureScript)
这篇关于是否有一个框架,允许我定义只有一次的模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!