1.0.2 • Published 2 years ago

and-db v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

👨‍💻 × Getting Started

  • First, you need to define a variable for the module. After that, you can call the base function to create a local instance of the AndDB database, your code should look like this:
const AndDB = require('and-db');
const db = AndDB();

You can learn about instance options later.

  • Now that your database instance has been created, you can use it. Below are some usage examples.
// ~ Set and Push examples:
db.ref('guide/example').set([]); // in Json File: { "guide": { "example": [] } }
db.ref('guide/example').push('Hello World'); // in Json File: { "guide": { "example": [ "Hello World" ] } }


// ~ Get example:
// In this database, the "Get" function has been replaced by the "Val" function.
db.ref('guide/example').val().then(value => {
    console.log(value); // in Console: [ "Hello World" ]
});

// or (in async function)
const value = await db.ref('guide/example').val(); // [ "Hello World" ]
console.log(value); // in Console: [ "Hello World" ]


// ~ Delete example:
db.ref('guide/example').delete();