Selaa lähdekoodia

refactor: clean up backend server code

theVakhovskeIsTaken 4 kuukautta sitten
vanhempi
sitoutus
a47de0bf17
1 muutettua tiedostoa jossa 5 lisäystä ja 16 poistoa
  1. 5 16
      backend/server.js

+ 5 - 16
backend/server.js

@@ -2,7 +2,6 @@ import dotenv from 'dotenv';
 import express from 'express';
 import cors from 'cors';
 import session from 'express-session';
-import FileStore from 'session-file-store';
 import fs from 'fs-extra';
 import path from 'path';
 import { fileURLToPath } from 'url';
@@ -24,8 +23,6 @@ import {
 const __filename = fileURLToPath(import.meta.url);
 const __dirname = path.dirname(__filename);
 
-// Initialize FileStore for sessions
-const FileStoreSession = FileStore(session);
 
 const app = express();
 const PORT = process.env.PORT || 3001;
@@ -44,24 +41,16 @@ app.use(express.urlencoded({ extended: true }));
 
 // Session configuration
 app.use(session({
-  store: new FileStoreSession({
-    path: path.join(__dirname, process.env.SESSIONS_DIR || 'sessions'),
-    ttl: 86400, // 24 hours in seconds
-    retries: 5,
-    factor: 1,
-    minTimeout: 50,
-    maxTimeout: 100
-  }),
   secret: process.env.SESSION_SECRET || 'gooneral-wheelchair-secret-key-change-in-production',
   resave: false,
   saveUninitialized: false,
   name: 'gooneral-session',
   cookie: {
-  secure: true,  // HTTPS required
-  httpOnly: true,
-  maxAge: 24 * 60 * 60 * 1000, // 24 hours
-  sameSite: 'lax'  // Changed from 'strict' to 'lax'
-}
+    secure: true,  // HTTPS required
+    httpOnly: true,
+    maxAge: 24 * 60 * 60 * 1000, // 24 hours
+    sameSite: 'lax'  // Changed from 'strict' to 'lax'
+  }
 }));
 
 // Ensure posts directory exists