使用 Mongoose、Node.js 和 Underscore 生成代码的直接方法?
我想生成这样的东西:
http:// /www.ivarvong.com/2010/08/node-js-connect-mongoose-and-underscore/
但我想生成html模板和其他客户端代码,并且要么有通用/整体保存/为 Node.js 代码和客户端(jQuery 或其他)查询/读取或生成个性化的代码,所有这些都基于模型。
比如使用 Underscore 来填充一些基于 Monogoose (MongoDB) 模型的模板。根据模型,您将获得一个可以填写的 HTML 表单、一些用于将该模型中的数据保存到 MongoDB 的客户端和服务器端代码,以及一些用于在列表或表中显示该模型的数据的代码。
I want to generate something like this:
http://www.ivarvong.com/2010/08/node-js-connect-mongoose-and-underscore/
But I want to generate the html template and other client-side code, and either have generic/monolithic save/query/reads or generate individualized ones for the Node.js code and the client side (jQuery or whatever), all of that based on the model.
So something like using Underscore to fill in a few templates based on some Monogoose (MongoDB) models. Based on the model you get an HTML form someone can fill in, some client and server-side code to save data in that model to MongoDB, and some code to display the data for that model in a list or table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我为此编写了一个库。 Resource-Juggling 获取您的 JugglingDB 模型(可能使用 Mongoose、Redis、MySQL 或其他数据库进行持久化)并将其作为 RESTful 资源公开。默认情况下,我们提供对所有这些内容的 JSON 访问,但只需编写必要的模板也可以使用 HTML。
请参阅https://github.com/bergie/resource-juggling#readme
I've written a library for this. Resource-Juggling takes your JugglingDB models (which may be persisted with Mongoose, Redis, MySQL, or other DBs) and exposes them as RESTful resources. By default we provide JSON access to all of them, but HTML is also possible by just writing the necessary templates.
See https://github.com/bergie/resource-juggling#readme
所以这是一个迟到的答复,但我相信这就是您正在寻找的项目:
Railway.js
这是一种Rails 和 Rails 之间的交叉节点/Express/猫鼬。如果您正在寻找 Node.JS 的 Rails,这似乎是最接近的东西。
So this is a late reply, but I believe that this is the project you're looking for:
Railway.js
It's kind of a cross between Rails & Node/Express/Mongoose. If you're looking for the Rails of Node.JS, this seems to be the closest thing.
这是我发现的另一个crud gen:
https://github.com/jspears/bobamo
我个人没有使用过还没有,但是当我生病时报告回来
Here is another crud gen i found:
https://github.com/jspears/bobamo
I havent personally used it yet, but when i do ill report back
请参阅AllcountJS快速应用程序开发框架。
它允许以类似 JSON 的格式定义域模型。例如,简单的 Hello World 应用程序将有一个名为 HelloWorld 的 MongoDB 集合,其中包含两个字段:文本“Foo”和日期“Bar”,看起来像
菜单、表格和表单 UI 是使用默认的 Jade 模板、AngularJS 和 Twitter Bootstrap 自动生成的。 AllcountJS 还提供了一种覆盖默认模板的方法,并具有其他扩展点。
See AllcountJS rapid application development framework.
It allows to define domain model in JSON-like format. For example simple Hello World application that would have one MongoDB collection named HelloWorld with two fields: text "Foo" and date "Bar" would look like
Menu, table and form UI is generated automatically using default Jade templates, AngularJS and Twitter Bootstrap. AllcountJS also provides a way to override default templates and has other extension points.
我不是 100% 确定我遵循,但也许像 Backbone.js 这样的东西会有所帮助。 Backbone 将提供一个 MVC 框架,使得在每一层中创建简单一致的组件变得非常容易。
I'm not 100% sure I follow but maybe something like Backbone.js would help. Backbone will provide an MVC framework making it very easy to create straightforward consistent components in each layer.