Skip to content

Instantly share code, notes, and snippets.

@hieptl
Created September 28, 2021 06:42
Show Gist options
  • Save hieptl/8ed9128dbe1cdf691bfe78a9053427c0 to your computer and use it in GitHub Desktop.
Save hieptl/8ed9128dbe1cdf691bfe78a9053427c0 to your computer and use it in GitHub Desktop.
requests.js - API - Get the List of Matching Requests - Tinder Clone
app.post("/requests/get", (req, res) => {
const { ccUid } = req.body;
const sql = "SELECT * FROM match_request WHERE match_request_from = ? || match_request_to = ?";
dbConn.query(sql, [ccUid, ccUid], function (err, result) {
if (err) {
res.status(200).jsonp({ message: 'Cannot get the list of match requests' });
} else {
res.status(200).jsonp(result);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment