0.0.3 • Published 1 year ago

json-store-list v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
1 year ago

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) {...})
0.0.3

1 year ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago