Skip to content

Instantly share code, notes, and snippets.

@rizkytegar
Created August 19, 2023 03:04
Show Gist options
  • Save rizkytegar/ad147fa90f8a0235c4a8766cc4f2d84e to your computer and use it in GitHub Desktop.
Save rizkytegar/ad147fa90f8a0235c4a8766cc4f2d84e to your computer and use it in GitHub Desktop.
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