Node.js SDK 2.0 for Usergrid
Currently a work in progress; documentation and implementation are subject to change.
Release Candidate 0, available here or on npm
Please open an issue
Install from npm, specifying the version >= 2.0.0-rc.0:
npm install usergrid >=2.0.0-rc.0
If you want to run the latest build, simply:
npm install r3mus/usergrid-nodejs
(though you will need to run npm install
to keep it up to date)
Note: This section is left intentionally light. In its current release candidate state, this SDK is only recommended for developers familiar with Usergrid, Node.js, and preferably Mocha tests. For full usage and implementation, have a look in /tests
.
There are two fundamental ways to use the new Node SDK:
Singleton pattern:
var Usergrid = require('usergrid') Usergrid.init({ orgId: ..., appId: ... } // or from a config file, see config.sample.json var Usergrid = require('usergrid') Usergrid.init() // defaults to use config.json
Instance pattern (primarily used when connecting to multiple Usergrid targets):
var UsergridClient = require('./node_modules/usergrid/lib/client') var client = new UsergridClient(config)