1.0.0 • Published 4 years ago
node-jsonbase v1.0.0
node-jsonbase
An api for interacting with jsonbase.com.
Installation
$ npm install node-jsonbase
Usage
At the begging of your code.
//Add the Node-JsonBase.
const JsonBase = require("node-jsonbase");
//Some random string which is used for authenticating.
const key = proccss.env.MYKEY;
//Create a new Storage.
const Storage = new JsonBase("secret-key");
Setting data
//Name to store it under.
let name = "example";
//Data to save.
let data = {hello:"world"};
//Save it.
Storage.set(name,value);
- Make sure
data
is a number, string or similiar which can be JSON.stringified. Storage.set()
returns a promise containing the data saved.
Getting Data
//Same string as above.
let name = "example";
//Get the Data
Storage.get(name);
Storage.get()
returns a promise containing the data saved.
1.0.0
4 years ago