postrest
PostgreSQL Restful Client that can be used from io.js/nodejs or browsers.
usage
NOTE: This project is currently in a volatile state and will get fully documented once the postgreSQL REST service has been realased.
var postrest = ; // Connect to database and perform some actions postrest ; { return dbdbdatabase; } { console; // http status code console;// server headers console; // result count console; // result items (undefined if count == 0, array if count > 1) var database = resresultrescount-1database; // pick last result list item return db; // create and return new database session }); { dbdatabase; return db; } { console; }
Postrest returns bluebird promises, read more about the bluebird API here: https://github.com/petkaantonov/bluebird/blob/master/API.md
var postrest = ; // connect to database 'bookstore' using schema 'v1' and with credentials passed in separatelypostrest;
raw sql query
{ db ;}
select shorthand using get method
dbsql console; console; ;
using postgresql json operators with limit option
dbsql ;
using the query builder (squel)
dbsql ;
Postrest uses the SQuel SQL builder, read more about that here: https://github.com/hiddentao/squel
REST adapter
This client uses a postgreSQL REST adapter which translates queries from http REST format to postgreSQL native protocol. The adapter is currently not open sourced (and may never be) but it is planned to be released as a restful database SaaS. Send an email to; contact at restfuldesign dot com, if you want to know more about that.