Clone or download
Pull request Compare This branch is 13 commits behind sylvainv:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
sql
test
.gitignore
.istanbul.yml
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

Manati

REST API for PostgreSQL. Forget ORM!

Build Status

Usage

var manati = require('pg-manati');
var app = manati(
  process.env.DATABASE_URL || 'postgres://user@localhost/database', // your database connection string
  'info' // the minumum log level that will be output
);

// Manati uses KoaJS, if you want to extend it to your needs you can use (see http://koajs.com/ for more info)
app.koa.use(function* (next) {
  // add whatever code you want, will be executed first
});

app.init();
app.start(3000);

Check our wiki for more information!

Example

Get some users data

GET /data/users?limit=2&name=like::J*
[{"name": "John", "age": 22}, {"name": "Jessie", "age": 30}]

Update some users data

PATCH /data/users?name=eq::Jessie
Content-Type application/json
{
  "age": 23
}
[{"name": "John", "age": 22}, {"name": "Jessie", "age": 23}]

Create some new data

POST /data/users
Content-Type application/json
{
  "name": "Joe",
  "age": 21
}
[{"name": "Joe", "age": 21}]

Delete some users data

GET /data/users?name=eq::John
[{"name": "John", "age": 22}]