Skip to content

Commit

Permalink
User-info-in-profile-info-working
Browse files Browse the repository at this point in the history
  • Loading branch information
fatcatt013 committed Mar 22, 2022
1 parent 7cb0bd8 commit 7ada741
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ app.post("/init-user", (req, res) => {
)

db.query("INSERT INTO UserInfo" +
" (User_id, name, class, guild, religion, city, region)" +
" VALUES (?, ?, ?, ?, ?, ?, ?)",
[id, name, class_, guild, religion, city, region],
" (User_id, name, class, guild, religion, city, region, pfp)" +
" VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
[id, name, class_, guild, religion, city, region, pfp],
(err) => {
if (err) {
console.log(err);
Expand All @@ -154,4 +154,23 @@ app.post("/init-user", (req, res) => {
)
});

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

console.log("Attempting to get player info of player: " + id);
db.query("SELECT * FROM UserInfo 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 information about User with ID " + id);
res.send({result: result});
}
});
});


app.listen(PORT, () => console.log("Server started on port: " + PORT));

0 comments on commit 7ada741

Please sign in to comment.