json-store-list

0.0.3 • Public • Published

json-store-list

Build Status

Simple JSON database to use with a Rest Api.

npm i --save json-store-list

This module is inspired from juliangruber/json-store. The main difference is that json-store-list store data as an array and asynchronously.

First init the store (make sure that the path is correctly defined):

var JSONStore = require('json-store-list');
var db = JSONStore('./index.json');

Functions

  • db.getAll(): get the whole file
  • db.get(label, key, cb): search an object, example: db.get('id', 1, function (err, obj) {...})
  • db.post(obj, cb): add a new object in the store
  • db.delete(label, key, cb): delete an object, example: db.delete('id', 1, function (err) {...})
  • db.put(label, key, newValue, cb): replace an object by a new one, example: db.put('id', 1, {id: 3, name:'new'}, function (err) {...})

Readme

Keywords

Package Sidebar

Install

npm i json-store-list

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

5.28 kB

Total Files

4

Last publish

Collaborators

  • cedced19