This commit is contained in:
2026-03-19 15:25:55 +07:00
parent 6cb4f53410
commit 64711bc54a
2 changed files with 29 additions and 0 deletions

View File

@@ -16,6 +16,13 @@ app.use(cors());
app.use(express.json());
app.use(express.static(path.join(__dirname, 'public')));
function requireAuth(req, res, next) {
if (!req.session || !req.session.authenticated) {
return res.status(401).json({ error: 'Unauthorized' });
}
next();
}
// Session configuration
app.use(session({
secret: process.env.SESSION_SECRET || 'default-secret-change-this',