feat: Initial commit of backend services and AGENTS.md

This commit is contained in:
William Valentin
2025-10-29 13:12:30 -07:00
commit 999d37babb
25 changed files with 3881 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
const jwt = require("jsonwebtoken");
module.exports = function (req, res, next) {
// Get token from header
const token = req.header("x-auth-token");
// Check if not token
if (!token) {
return res.status(401).json({ msg: "No token, authorization denied" });
}
// Verify token
try {
const decoded = jwt.verify(token, process.env.JWT_SECRET);
req.user = decoded.user;
next();
} catch (err) {
res.status(401).json({ msg: "Token is not valid" });
}
};