A Lightweight JSON File-Based Database for Development
'Dev-Database' is a simple npm package that provides a straightforward way to perform database operations using JSON files. It's designed to be lightweight and suitable for small-scale development projects, making it easy to store and retrieve data.
To use 'Dev-Database' in your project, install it using npm:
npm install dev-database
Create an instance of 'DevDatabase' by providing the path to your JSON file. Here's a quick example:
const DevDatabase = require('dev-database');
// Create an instance of DevDatabase with the file path
const db = new DevDatabase('database.json');
// Example usage
db.setData('key1', 'value1');
console.log(db.getData('key1')); // Output: 'value1'
'setData(key, value)' Set a key-value pair in the database.
db.setData('key', 'value');
'getData(key)' Retrieve the value associated with a key from the database.
const value = db.getData('key');
'deleteData(key)' Delete a key-value pair from the database.
db.deleteData('key');
If the JSON file doesn't exist initially, the package will create an empty database.
Contact me in my Discord Developers Server https://discord.gg/Ym5V2DB6sk .