orm to work with nodejs
JavaScript Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
benchmark
docs
example
lib
support/jsdoc
test
.gitignore
.npmignore
History.md
LICENSE
Makefile
README.md
index.js
package.json

README.md

Moose

Overview

An ORM for node with these features:

  • Migrations
  • Associations
  • Connection pooling
  • Support for multiple databases
  • A plugin api, e.g., from examples/plugins/ExpressPlugin.js
/*
* Very simple express routing for a model
* */
var moose = require("../../lib"), comb = require("comb");
module.exports = exports = comb.define(null, {
   static : {
       route : function(app){
           app.get("/" + this.tableName + "/:id", comb.hitch(this, function(req, res){
               var id = req.params.id;
               this.findById(id).then(function(model){
                   var response;
                   if(model){
                       response = model.toObject();
                   }else{
                       response = {error : "Could not find a model with id " + id};
                   }
                   res.send(response);
               });
           }));
       }
   }
});

Installation

npm install moose

Usage

License

MIT https://github.com/Pollenware/moose/raw/master/LICENSE

Meta