summaryrefslogtreecommitdiff
path: root/middlewares
diff options
context:
space:
mode:
authorJulien Dessaux2023-01-05 02:09:07 +0100
committerJulien Dessaux2023-01-05 02:09:07 +0100
commitd7ed1196bdd44d7734d41d91a5e72a71785e0a08 (patch)
treeaafae6571d5154dc5e9a061c8f54ca8e9b1287ad /middlewares
parentAdded more tests (diff)
downloadjeux-de-mots-d7ed1196bdd44d7734d41d91a5e72a71785e0a08.tar.gz
jeux-de-mots-d7ed1196bdd44d7734d41d91a5e72a71785e0a08.tar.bz2
jeux-de-mots-d7ed1196bdd44d7734d41d91a5e72a71785e0a08.zip
switched to single quotes string in eslint
Diffstat (limited to '')
-rw-r--r--middlewares/formParser.js2
-rw-r--r--middlewares/helmet.js4
-rw-r--r--middlewares/requireAuth.js2
-rw-r--r--middlewares/sessions.js20
4 files changed, 14 insertions, 14 deletions
diff --git a/middlewares/formParser.js b/middlewares/formParser.js
index 41134ac..b117045 100644
--- a/middlewares/formParser.js
+++ b/middlewares/formParser.js
@@ -1,3 +1,3 @@
-import bodyParser from "body-parser";
+import bodyParser from 'body-parser';
export default bodyParser.urlencoded({ extended: false });
diff --git a/middlewares/helmet.js b/middlewares/helmet.js
index 5ced2c3..67d6e98 100644
--- a/middlewares/helmet.js
+++ b/middlewares/helmet.js
@@ -1,10 +1,10 @@
-import helmet from "helmet";
+import helmet from 'helmet';
const myHelmet = helmet({
contentSecurityPolicy: {
directives: {
...helmet.contentSecurityPolicy.getDefaultDirectives(),
- "script-src": ["'self'", "'unsafe-inline'"],
+ 'script-src': ['\'self\'', '\'unsafe-inline\''],
},
},
});
diff --git a/middlewares/requireAuth.js b/middlewares/requireAuth.js
index 1ea6deb..4d85e43 100644
--- a/middlewares/requireAuth.js
+++ b/middlewares/requireAuth.js
@@ -2,7 +2,7 @@ function requireAuth(req, res, next) {
if (req.session.user !== undefined) {
return next();
}
- return res.redirect(302, "/login");
+ return res.redirect(302, '/login');
}
export default requireAuth;
diff --git a/middlewares/sessions.js b/middlewares/sessions.js
index 901c262..30f5c49 100644
--- a/middlewares/sessions.js
+++ b/middlewares/sessions.js
@@ -1,21 +1,21 @@
-import expressSession from "express-session";
-import Database from "better-sqlite3";
-import sqliteStore from "better-sqlite3-session-store";
+import expressSession from 'express-session';
+import Database from 'better-sqlite3';
+import sqliteStore from 'better-sqlite3-session-store';
const SqliteStore = sqliteStore(expressSession);
const db = new Database(
- process.env.NODE_ENV === "test" ? "testsessions.db" : "sessions.db",
- process.env.NODE_ENV === "development" ? { verbose: console.log } : null
+ 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 secret = process.env.SESSION_SECRET || 'secret';
const session = expressSession({
cookie: {
httpOnly: true,
maxAge: 1000 * 60 * 60 * 24 * 15, // 15 days
- sameSite: "Strict",
- secure: process.env.NODE_ENV === "production" ? true : false,
+ sameSite: 'Strict',
+ secure: process.env.NODE_ENV === 'production' ? true : false,
},
- name: "JDMSessionId",
+ name: 'JDMSessionId',
saveUninitialized: false,
secret: secret,
store: new SqliteStore({
@@ -26,7 +26,7 @@ const session = expressSession({
}
}),
resave: false,
- unset: "destroy",
+ unset: 'destroy',
});
export default session;