jsonstore.io
v1.2.1
Published
A node wrapper library for jsonstore.io api.
Downloads
17
Maintainers
Readme
Dead: jsonstore.io - Node Library
~~A node wrapper library for www.jsonstore.io~~
jsonstore.io has been shutdown by the creator. If you are looking for an free object store for your projects, check jsonbase.com We have ported the jsonstore.io library with same APIs: npm - jsonbase.com
Links:
Install
npm install --save jsonstore.io
Examples
Make sure to replace the TOKEN in the examples to your own TOKEN, that can be found at https://www.jsonstore.io/.
Eg. https://www.jsonstore.io/<TOKEN>
Write Data
var jsonstore = require('jsonstore.io')
// Replace this token with your token.
const TOKEN = '3c9622697a53d8b2f3cf825dc4160f7e1aad46c1a759475edeb76bce5cd33a64'
let store = new jsonstore(TOKEN)
// Any valid JSON object can be written to given end-point
store.write('Person',{ Name: 'John Doe', Age: 56})
// Inner JSON object/Value can be created or modified using URL type path.
store.write('Person/Email','[email protected]')
Read Data
var jsonstore = require('jsonstore.io')
// Replace this token with your token.
const TOKEN = '3c9622697a53d8b2f3cf825dc4160f7e1aad46c1a759475edeb76bce5cd33a64'
let store = new jsonstore(TOKEN)
// Reading data from any JSON object returns promise.
store.read('Person').then( (data) => {
console.log(data) // { "Age":56, "Email":"[email protected]", "Name":"John Doe" }
})
// Value of any key can be accessed directly.
store.read('Person/Name').then( (data) => {
console.log(data) // John Doe
})
Delete Data
var jsonstore = require('jsonstore.io')
// Replace this token with your token.
const TOKEN = '3c9622697a53d8b2f3cf825dc4160f7e1aad46c1a759475edeb76bce5cd33a64'
let store = new jsonstore(TOKEN)
// Pass JSON key to delete.
store.delete('Person/Name')
If you don't pass any key to delete method then all the data would be deleted.i.e Root node will be deleted.