]> git.cworth.org Git - zombocom-ai/blobdiff - index.js
Use a single function for the tardis app
[zombocom-ai] / index.js
index 7083b13dc1eb790b1c26400ca67de44596a09fd7..04fe9bb0c65152eb1537d98a08e2315ca3430655 100644 (file)
--- a/index.js
+++ b/index.js
@@ -75,7 +75,14 @@ const session_middleware =  session(
      secret: process.env.ZOMBOCOM_SESSION_SECRET,
      resave: false,
      saveUninitialized: true,
-     rolling: true
+     rolling: true,
+     // Let each cookie live for a full month
+     cookie: {
+         path: '/',
+         httpOnly: true,
+         secure: false,
+         maxAge: 1000 * 60 * 60 * 24 * 30
+     }
     });
 
 app.use(session_middleware);
@@ -114,17 +121,12 @@ app.get('/index.html', (req, res) => {
     res.sendFile(__dirname + '/index.html');
 });
 
-app.get('/tardis', (req, res) => {
+function tardis_app(req, res) {
     res.sendFile(__dirname + '/tardis.html');
-});
-
-app.get('/tardis/', (req, res) => {
-    res.sendFile(__dirname + '/tardis.html');
-});
+}
 
-app.get('/tardis/index.html', (req, res) => {
-    res.sendFile(__dirname + '/tardis.html');
-});
+app.get('/tardis', tardis_app);
+app.get('/tardis/', tardis_app);
 
 io.on('connection', (socket) => {