Skip to content

Commit

Permalink
profile-info-done
Browse files Browse the repository at this point in the history
  • Loading branch information
fatcatt013 committed Mar 23, 2022
1 parent 7ada741 commit f29418b
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ app.post("/init-user", (req, res) => {
)
});

app.post("/get-profile-info", (req, res) => {
app.post("/get-user-info", (req, res) => {
const id = req.body.id;

console.log("Attempting to get player info of player: " + id);
console.log("Attempting to get user info of user: " + id);
db.query("SELECT * FROM UserInfo WHERE User_id = ?", [id], (err, result) => {
if (err) {
console.log("There was an error");
Expand All @@ -166,7 +166,25 @@ app.post("/get-profile-info", (req, res) => {
console.log("Cannot find a User with ID of " + id);
}
else {
console.log("Successfuly sent response with information about User with ID " + id);
console.log("Successfuly sent response with UserInfo with ID " + id);
res.send({result: result});
}
});
});

app.post("/get-user-stats", (req, res) => {
const id = req.body.id;

console.log("Attempting to get user stats of user: " + id);
db.query("SELECT * FROM UserStats WHERE User_id = ?", [id], (err, result) => {
if (err) {
console.log("There was an error");
}
if (result < 1){
console.log("Cannot find a User with ID of " + id);
}
else {
console.log("Successfuly sent response with UserStats with ID " + id);
res.send({result: result});
}
});
Expand Down

0 comments on commit f29418b

Please sign in to comment.