Created
August 19, 2023 03:04
-
-
Save rizkytegar/ad147fa90f8a0235c4a8766cc4f2d84e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/users', (req, res) => { | |
const username = req.query.username; | |
const sql = 'SELECT * FROM users WHERE username = ?'; | |
db.query(sql, username, (err, results) => { | |
if (err) { | |
console.error('Error executing query:', err); | |
return res.status(500).send('Error executing query'); | |
} | |
res.json(results); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment