Skip to content
Snippets Groups Projects
Commit d6b55719 authored by Zaman, Orangzaib (UG - Computer Science)'s avatar Zaman, Orangzaib (UG - Computer Science)
Browse files

Added methods for checking a users email and getting a users details given their id

parent 9a4d8ecb
No related branches found
No related tags found
2 merge requests!8CI/CD,!3Users service
...@@ -44,11 +44,27 @@ export const signup = async (req, res) => { ...@@ -44,11 +44,27 @@ export const signup = async (req, res) => {
} }
export const checkUserEmail = async (req, res) => { export const checkUserEmail = async (req, res) => {
const { email } = req.params;
try {
const user = await User.findOne({ email });
return res.status(200).json(user);
} catch (error) {
res.status(500).json({ message: "Something went wrong" });
}
} }
export const getUserById = async (req, res) => { export const getUserById = async (req, res) => {
const { id } = req.params;
try {
const user = await User.findById(id);
return res.status(200).json(user);
} catch (error) {
res.status(500).json({ message: "Something went wrong" });
}
} }
export default router; export default router;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment