Skip to content

Instantly share code, notes, and snippets.

@bchiang7
Created November 8, 2019 03:03
Show Gist options
  • Save bchiang7/030bd93ae08f25da072727aa4bc94473 to your computer and use it in GitHub Desktop.
Save bchiang7/030bd93ae08f25da072727aa4bc94473 to your computer and use it in GitHub Desktop.
/**
* Delete a user with the given ID
*/
const deleteUser = async (req, res, next) => {
const { id } = req.params;
try {
await User.deleteUserById(id);
res.status(202).json({ message: `User ${id} deleted!` });
} catch (e) {
const err = new Error('Could not delete user');
next(err);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment