Simple database made with JSON.
Install
npm install jsondbnode
Limitations
- You may have problems with create and edit at the same time.
- There is no backup, if the db.json get corrupted it's over
Usage
var DB = require("jsondbnode");
const Books = DB.model
const DBCONFIG = DB.manager
DBCONFIG.configDB({ dbPath: "./db.json" })
DBCONFIG.resetDB().then(console.log).catch(console.error)
new Books({
name: "The lord of the rings",
create_at: new Date(1954, 6, 28)
}).save().then((newBook) => {
console.log(newBook)
newBook.create_at = new Date(1954, 6, 29)
newBook.save().then(console.log).catch(console.error)
}).catch(console.error)
Se more at Example