properly load middleware

This commit is contained in:
b1ek 2023-02-25 16:39:30 +10:00
parent 6af483ece5
commit 80c0a8be3e
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 22 additions and 4 deletions

View File

@ -1 +1,16 @@
module.exports = (router) => {}
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;

View File

@ -1,3 +1,6 @@
const express = require('express');
const router = express.Router();
async function handler(req, res, next) { async function handler(req, res, next) {
// TODO: // TODO:
// Log only non-automatical requests // Log only non-automatical requests
@ -11,6 +14,6 @@ async function handler(req, res, next) {
next(); next();
} }
module.exports = (router) => {
router.use(handler); router.use(handler);
}
module.exports = router