summaryrefslogtreecommitdiff
path: root/middlewares/sessions.js
diff options
context:
space:
mode:
authorJulien Dessaux2023-01-01 23:23:57 +0100
committerJulien Dessaux2023-01-02 20:26:28 +0100
commit3acf783d948ebb1907da875ef87b0da9ef2309ff (patch)
tree06b805fab10e638a9f5e66714ef4a29b6409c1e7 /middlewares/sessions.js
parentRefactored game creation (diff)
downloadjeux-de-mots-3acf783d948ebb1907da875ef87b0da9ef2309ff.tar.gz
jeux-de-mots-3acf783d948ebb1907da875ef87b0da9ef2309ff.tar.bz2
jeux-de-mots-3acf783d948ebb1907da875ef87b0da9ef2309ff.zip
Began adding tests
Diffstat (limited to '')
-rw-r--r--middlewares/sessions.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/middlewares/sessions.js b/middlewares/sessions.js
index 8697ae0..901c262 100644
--- a/middlewares/sessions.js
+++ b/middlewares/sessions.js
@@ -1,9 +1,12 @@
import expressSession from "express-session";
-import sqlite from "better-sqlite3";
+import Database from "better-sqlite3";
import sqliteStore from "better-sqlite3-session-store";
const SqliteStore = sqliteStore(expressSession);
-const db = new sqlite("sessions.db", process.env.NODE_ENV === "production" ? null : { verbose: console.log });
+const db = new Database(
+ process.env.NODE_ENV === "test" ? "testsessions.db" : "sessions.db",
+ process.env.NODE_ENV === "development" ? { verbose: console.log } : null
+);
const secret = process.env.SESSION_SECRET || "secret";
const session = expressSession({
cookie: {