Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Straightforward way to generate code with Mongoose and Node.js and Underscore?

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.

like image 642
Jason Livesay Avatar asked Nov 27 '10 10:11

Jason Livesay


1 Answers

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

like image 97
bergie Avatar answered Sep 19 '22 08:09

bergie