Added header
This commit is contained in:
@@ -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' });
|
||||
|
||||
Reference in New Issue
Block a user