aboutsummaryrefslogtreecommitdiffstats
path: root/lib/db.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/db.js')
-rw-r--r--lib/db.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/db.js b/lib/db.js
new file mode 100644
index 00000000..76653c81
--- /dev/null
+++ b/lib/db.js
@@ -0,0 +1,14 @@
+import { createClient } from "redis";
+
+export const db = createClient({
+ url: "redis://rd"
+});
+
+db.on("error", err => console.log("db error", err));
+
+await db.connect();
+
+export default db;
+
+export let g = async k => JSON.parse(await db.get(k));
+export let s = (k, v) => db.set(k, JSON.stringify(v));