NyaDB
Simple JSON "database" for NodeJS.
All files (databases) will be stored in the NyaDB
folder in the project's root directory.
Installation
npm install @decaded/nyadb
Usage
Initialize
const NyaDB = require('@decaded/nyadb');
const nyadb = new NyaDB();
Create new database
nyadb.create('test'); // Creates a new database called 'test'
Inserting data
const mockDatabase = {
yellow: ["banana", "citrus"],
red: ["apple", "paprika"],
};
nyadb.set('test', mockDatabase); // Sets the database 'test' to the 'mockDatabase' object
Retrieving data
nyadb.get('test'); // Returns the 'test' database
// {
// "yellow": ["banana", "citrus"],
// "red": ["apple", "paprika"],
// }
nyadb.getList(); // Returns the names of all databases in an array
// ['test']
Deleting data
nyadb.delete('test'); // Deletes the database 'test'