UNPKG

pokerdb

Version:

Database Library As Internal File

58 lines (52 loc) 1.18 kB
# what is pokerdb ? - pokerdb is a library stored as a json file # Benefit - You can use it in small projects or tests without a database server - Library size is very light - Query and modify data using plain JS - Simple API easy to learn # Warning If you are using nodemon. please create nodemon.json file and add this attribute as it is necessary ```JAVASCRIPT { "ignore": ["pokerdb/*"] } ``` # Install ```sh npm install pokerdb ``` # Usage ```javascript // Require var db = require("pokerdb") // Query to 1 table var user = db.table("user") // Add data to the table user.add({ name: "Poker", age: 19 }) // Do not add the "id" attribute as it will be added automatically // Get all data in 1 table user.all().then(data => console.log(data)) // Get data on 1 row user.row({ id: 1}).then(data => console.log(data)) // Edit data on 1 row user.edit({ id: 1},{ name: "John" }) // Delete data on 1 row user.del({id : 1}) // Delete Table user.delete ``` # Support Async/Await ```JAVASCRIPT (async () => { var data = await user.all() var data = await user.row({id: 1}) console.log(data) }) ``` # Im From Vietnam