var levelup = require('levelup');

var LevelREST = require('level-rest');



var db = levelup('./mydb', { valueEncoding: 'json' });

var rest = new LevelREST(db, {

  id: 'id',

  metaKey: 'meta',

  serialize: function(url) {

    url = url.split('/');

    return { api: url[0], id: url[1] };

  },

});



// POST data in rest

rest.post('people', { id: 1, name: 'John Doe' });