diff --git a/middleware/session.js b/middleware/session.js index 22b14f2..04b0a43 100644 --- a/middleware/session.js +++ b/middleware/session.js @@ -1 +1,16 @@ -module.exports = (router) => {} \ No newline at end of file + +const Redis = require("ioredis").Redis; +/** @type {import('ioredis').Redis} */ +const redis = new Redis(process.env.REDIS_PORT, process.env.REDIS_HOST); + +const express = require('express'); +const router = express.Router(); + +async function session(req, res, next) { + res.send(req.cookies); + return; +} + +router.use(session); + +module.exports = router; \ No newline at end of file diff --git a/middleware/session_back.js b/middleware/session_back.js index c47d8e5..c6c1b0d 100644 --- a/middleware/session_back.js +++ b/middleware/session_back.js @@ -1,3 +1,6 @@ +const express = require('express'); +const router = express.Router(); + async function handler(req, res, next) { // TODO: // Log only non-automatical requests @@ -11,6 +14,6 @@ async function handler(req, res, next) { next(); } -module.exports = (router) => { - router.use(handler); -} \ No newline at end of file +router.use(handler); + +module.exports = router \ No newline at end of file