ReplDB Deno is just that, a client for ReplDB written for use in Deno and other TypeScript environments.
First, you want to import the ReplDB Client. In Deno, you can import it directly from its GitHub URL
import { ReplDBClient } from 'https://raw.githubusercontent.com/lunaroyster/repldb-deno/master/mod.ts';
To initialize, use one of these:
// This only works if REPLIT_DB_URL is defined, which should be the case when running in Repl.it
const replDB = ReplDBClient.createFromEnv();
const dbUrl = Deno.env.get('REPLIT_DB_URL');
const replDB = new ReplDBClient(dbUrl);
You can also initialize ReplDB in json mode, which automatically serializes and deserializes values to JSON strings before storing in ReplDB.
const replDB = new ReplDBClient(dbUrl, { mode: 'json' });
Or,
const replDB = ReplDBClient.createFromEnv({ mode: 'json' });
Here's some examples
// Setting a value for a given key
await replDB.set('date', '6/28/2020');
// Getting a value
let date = await replDB.get('date');
console.log(date);
// 6/28/2020
// Listing all keys
let keys = await replDB.list();
console.log(keys);
// [ "date" ]
// Deleting a key (and its value)
await replDB.delete('date')
console.log(await replDB.list().length === 0)
// true
The client contains 'Core functions' that are wrappers around the main http calls. These start with a capital letter.