ClusterPoint Cloud API Service for Sails Framework
Place the CPSDB.js inside /api/services/
. Since services are global in sails, it is possible to call it from anywhere inside project root folder.
$ npm install cps-api --save
Code inside controllers or models
var cps = CPSDB.init('database'); // Parameter is the name of database.
You have to call init function to connect to each database.
cps.insert( object, callback );
cps.update( object, callback );
cps.replace( object, callback );
cps.partialReplace( object, callback );
cps.delete( object, callback );
cps.search( array, callback ); // Array example: [{ id: uid }]
cps.lookup( array,callback );
cps.retrieve( array, callback );
cps.listLast( integer, integer, callback );
cps.listPaths( callback );
API Reference
API Code Sample