smart-brain-api/controllers/profile.js
2022-01-01 10:01:04 -05:00

20 lines
387 B
JavaScript

const handleProfileGet = (req, res, db) => {
const { id } = req.params;
db.select("*")
.from("users")
.where({
id: id,
})
.then((user) => {
if (user.length) {
res.json(user[0]);
} else {
res.status(400).json("Not found.");
}
})
.catch((err) => res.status(400).json("Error getting user."));
};
module.exports = {
handleProfileGet: handleProfileGet,
};