Add Docker build workflow and mobile application

This commit is contained in:
Sven laptop
2026-05-05 17:39:02 +02:00
parent 39278dc857
commit 00758561f9
159 changed files with 8424 additions and 3 deletions
+23
View File
@@ -0,0 +1,23 @@
const jwt = require('jsonwebtoken');
require('dotenv').config();
const JWT_SECRET = process.env.JWT_SECRET;
// Middleware to verify JWT token
const authMiddleware = (req, res, next) => {
const auth = req.headers.authorization;
if (!auth || !auth.startsWith('Bearer ')) {
return res.status(401).json({ error: 'missing_token' });
}
const token = auth.slice(7);
try {
const payload = jwt.verify(token, JWT_SECRET);
req.user = payload;
next();
} catch (err) {
return res.status(401).json({ error: 'invalid_token' });
}
};
module.exports = { authMiddleware };