Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Have Nodejitsu? Enjoy your database.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
.npmignore
README.md
package.json

README.md

jitsudb

Do you hate trying to set up a database? Do you often reach for flat files? Well with all new jitsudb and a Nodejitsu account, it's now as easy as require("jitsudb")!

  • Automatically requisitions the database if it doesn't exist!
  • Only needs 3 arguments: The type, the name and a callback!
  • Reads nodejitsu data from ~/.jitsuconf!
  • Database types: couch, redis or mongo !
  • Extra support for: cradle, node_redis and mongoose!

Example: Grab a couch!

require("jitsudb")("couch", "myCouch", function (url) {
    //url is a couch url!
    require("request")(url, function (err, resp, body) {
        // . . .
    });
});

Example: Let's use mongoose instead!

require("jitsudb")("mongoose", "myMongo", function (mongoose) {
    // mongoose is connected and ready to roll!
    var SweetModel = mongoose.model("sweetModel");
});

Install:

npm install jitsudb

Usage:

require("jitsudb")(type, name, cb);

type may be "couch", "redis", "mongo", "cradle", "node_redis" or "mongoose."

name is a name for your database. It's used by Nodejitsu to keep track of all your databases.

cb is dependent on type. "couch", "redis" and "mongo" return the database url. "cradle" returns a cradle connection object, while "node_redis" and "mongoose" return connected redis and mongoose objects, respectively.

Tests:

There are no tests written at the moment. This is because the tests would be specific to a given nodejitsu account. It'd be awkward. Really.

Contribute:

Yes please! I accept pull requests and issues!

License:

MIT!

Something went wrong with that request. Please try again.