clkao/pgrest — pull request #46 by poga (2013-11-25 04:26:09+00:00)
Title: Firebase-compatible API with PgREST

## example:

```
var ref = new PgBase("http://127.0.0.1:3000/foo");
ref.on("child_added", function(it) {
$("#log").append(it.info.bar);
});

ref.push({_id:3, info: { bar: "Ke"}});
```

## API

Basic read/write/subscribe APIs in [this page](https://www.firebase.com/docs/javascript/firebase/index.html) are supported. Here is the list of unimplemented APIs:

* auth
* unauth
* setWithPriority
* setPriority
* transaction
* limit
* startAt
* endAt

## Reference

There are three type of reference you can create: collection, entry, and column:

collection:
```
var collection_ref = new PgBase("http://127.0.0.1:3000/foo");
```

entry:
```
var entry_ref = new PgBase("http://127.0.0.1:3000/foo/1");
```

column:
```
var column_ref = new PgBase("http://127.0.0.1:3000/foo/1/bar");
```

if some API is/should not work on the type of reference, it will throw unimplemented exception.

## change notes
* triggers and function in postgre will only be created in mount-socket, instead of every time someone subscribe. So a performance gain
* Since subscribing is much faster now, the subscription complete callback is not needed. Therefore, the "on/once/off" API becomes identical to firebase
* [browserify](https://github.com/substack/node-browserify) is added to dev-dependency. It's used to create browser-compatible pgbase.js
* lots of bugs fixed. maybe also lots of bugs created