Starter App - Endb

Endb is simple key-value storage with support for multiple backends.
This app presents and demonstrates the very basics of Endb and how easy it is to create a database of your choice. (SQLite, MongoDB, MySQL, PostgreSQL, whatnot).

Start by Remixing: glitch:endb-starter/remix
GitHub: github:endb

Example

const Endb = require('endb');

// One of the following
const endb = new Endb();
const endb = new Endb('leveldb://path/to/database'); // npm i level
const endb = new Endb('nedb://path/to/database'); // npm i nedb
const endb = new Endb('mongodb://user:pass@localhost:27017/dbname'); // npm i mongojs
const endb = new Endb('mysql://user:pass@localhost:3306/dbname'); // npm i mysql2 sql
const endb = new Endb('postgresql://user:pass@localhost:5432/dbname'); // npm i pg sql
const endb = new Endb('redis://user:pass@localhost:6379'); // npm i ioredis
const endb = new Endb('sqlite://path/to/database.sqlite'); // npm i sqlite3 sql

// Handles connection errors.
endb.on('error', err => console.log('Connection Error: ', err));

await endb.set('foo', 'bar'); // true
await endb.get('foo'); // 'bar'
await endb.all(); // [ ... ]
await endb.has('foo'); // true
await endb.delete('foo'); // true
await endb.clear(); // undefined

If you have any improvements, suggestions, or questions, please ask here or open an issue on the GitHub repository page.

1 Like