MCPcopy Create free account
hub / github.com/Muhammadsiddiq-code/backend-group-lessons / deleteUser

Function deleteUser

controller/userController.js:328–343  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

326
327// Delete user
328const deleteUser = async (req, res) => {
329 try {
330 const userId = req.params.id;
331
332 const deletedUser = await User.findByIdAndDelete(userId);
333
334 if (!deletedUser) {
335 return res.status(404).json({ message: "User not found" });
336 }
337
338 res.json({ message: "User deleted successfully", deletedUser });
339 } catch (error) {
340 console.error(error);
341 res.status(500).json({ message: "Internal Server Error" });
342 }
343};
344
345// Login
346const postLogin = async (req, res) => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected