|
|
|
|
|
|
|
|
const allUsers = await User.find({}) |
|
|
const allUsers = await User.find({}) |
|
|
return res.status(200).send(allUsers) |
|
|
return res.status(200).send(allUsers) |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
next(e) |
|
|
|
|
|
|
|
|
return res.status(500).send('Internal server error!') |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return res.status(404).send("User with the id of: " + id + " doesnt exist") |
|
|
return res.status(404).send("User with the id of: " + id + " doesnt exist") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return res.status(200).json(user) |
|
|
|
|
|
|
|
|
return res.json(user) |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
next(e) |
|
|
|
|
|
|
|
|
return res.status(404).send('User not found!') |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return res.status(200).send('User updated successfully') |
|
|
return res.status(200).send('User updated successfully') |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
next(e) |
|
|
|
|
|
|
|
|
return res.status(500).send(e.message) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
return res.status(200).send('user contacts updated successfully') |
|
|
return res.status(200).send('user contacts updated successfully') |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
next(e) |
|
|
|
|
|
|
|
|
return res.status(500).send(e.message) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return res.status(204).send('Deleting user with id of ' + id) |
|
|
return res.status(204).send('Deleting user with id of ' + id) |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
next(e) |
|
|
|
|
|
|
|
|
return res.status(500).send(e.message) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|