30

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.

Jason Livesay
  • 6,116
  • 3
  • 22
  • 30
  • 1
    Over the past three weeks, I have searched far and wide for exactly this but came up empty :-/ – Mike Repass Mar 18 '11 at 23:11
  • 2
    You know, it's almost a year later and I'm still looking for this. Seems like an essential piece of glue to really make all of these parts work. Otherwise, we still have to sit around writing CRUD code. – Gates VP Oct 05 '11 at 06:40
  • The chance to explore new (or new again) approaches based on asynchronous code is one of the best parts of building software with node. That being said, it's always annoying when you don't have the tool you want. – wprl Jun 28 '12 at 14:35
  • I modified the wording so it doesn't ask for a tool or library. If you can recommend a better site for this question, then let's please move it there. Otherwise, it now 'fits the format' so please leave it, because other people are obviously finding this information useful. – Jason Livesay Jul 26 '13 at 09:58
  • Did you ever find anything for this? – stampede76 Aug 29 '14 at 02:24
  • @steve76 for that particular application I ended up not using Mongoose and (for the database part) doing something like this: https://gist.github.com/runvnc/4191057 This is the project I started (not finished) back then https://github.com/runvnc/cureblog Recently I have also been using ToffeeScript and redis so I can just do stuff like this e, res = red.hmset! 'myobj', { name: 'bob', address: '123 Main St.' } – Jason Livesay Aug 29 '14 at 11:31

5 Answers5

3

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.

UpTheCreek
  • 28,433
  • 31
  • 143
  • 214
Gates VP
  • 43,525
  • 11
  • 99
  • 107
3

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

bergie
  • 930
  • 7
  • 7
2

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

mkoryak
  • 54,015
  • 59
  • 193
  • 252
2

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

A.app({
  appName: "Hello World",
  menuItems: [
    {
      name: "Hello world",
      entityTypeId: "HelloWorld",
    }
  ],
  entities: function(Fields) {
    return {
      HelloWorld: {
        fields: {
          foo: Fields.text("Foo"),
          bar: Fields.date("Bar")
        }
      }
    }
  }
});

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.

Pavel Tiunov
  • 958
  • 5
  • 7
0

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.

lebreeze
  • 4,916
  • 23
  • 34