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' });
level restLevelUP的REST适配器示例
文件列表
level-rest-master.zip
(预估有个10文件)
level-rest-master
LICENSE-MIT
1KB
.travis.yml
38B
test
browser.js
107B
fixtures
posts.js
208B
users.js
75B
index.js
6KB
README.md
2KB
暂无评论