This commit is contained in:
Lukian LEIZOUR 2024-05-31 16:03:24 +02:00
parent 4825be45e1
commit 0bac40a72f
8 changed files with 256 additions and 16 deletions

23
api/v1/games/getall.js Normal file
View file

@ -0,0 +1,23 @@
const express = require('express');
const jwt = require('jsonwebtoken');
const {getGames} = require("../../../libs/mysql.js")
const router = express.Router();
router.post('/', async (req, res) => {
const {token} = req.body;
let user;
try {
user = jwt.verify(token, process.env.JWTSecret);
} catch {
return res.status(500).send({error: "invalid token"});
}
const games = await getGames();
res.status(200).send(games);
});
module.exports = router;