Added header

This commit is contained in:
Marces Zastrow
2024-12-18 11:20:28 +01:00
parent dab55442be
commit 0c4af623bc
6 changed files with 10 additions and 8 deletions
+2
View File
@@ -40,6 +40,7 @@ db.run(`CREATE TABLE IF NOT EXISTS games (
// Registration route
app.post('/register', async (req, res) => {
const { username, email, password } = req.body;
console.log("Trying to Register: ", username);
try {
const hashedPassword = await bcrypt.hash(password, 10);
const stmt = db.prepare('INSERT INTO users (username, email, password) VALUES (?, ?, ?)');
@@ -58,6 +59,7 @@ app.post('/register', async (req, res) => {
// Login route
app.post('/login', (req, res) => {
const { username, password } = req.body;
console.log("Trying to Login: ", username);
db.get('SELECT * FROM users WHERE username = ?', [username], async (err, row) => {
if (err) {
return res.status(500).json({ error: 'Internal server error' });