diff options
author | Julien Dessaux | 2023-01-01 23:23:57 +0100 |
---|---|---|
committer | Julien Dessaux | 2023-01-02 20:26:28 +0100 |
commit | 3acf783d948ebb1907da875ef87b0da9ef2309ff (patch) | |
tree | 06b805fab10e638a9f5e66714ef4a29b6409c1e7 /middlewares/sessions.js | |
parent | Refactored game creation (diff) | |
download | jeux-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.js | 7 |
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: { |