aboutsummaryrefslogtreecommitdiffstats
path: root/lib/db.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-16 23:40:25 -0800
committerAdam Soltys <[email protected]>2023-01-16 23:40:25 -0800
commit91e847126c832efa25ab0bf8d6f3b7e537378fa7 (patch)
tree4a42b6e3bec6eb0f640ed44533b54e6d3d6a5e0e /lib/db.js
parent6bafea9bffe24d2227d269812a73a9a513d92ddf (diff)
downloadcoinos-server-91e847126c832efa25ab0bf8d6f3b7e537378fa7.tar.gz
coinos-server-91e847126c832efa25ab0bf8d6f3b7e537378fa7.zip
shuffle things around
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));