浏览代码

User endpoints fixes (#42)

pull/43/head
djordje.djoric 3 年前
父节点
当前提交
65a739f240
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6
    6
      src/endpoints/user.js

+ 6
- 6
src/endpoints/user.js 查看文件

@@ -7,7 +7,7 @@ const getUsers = async (req, res, next) => {
const allUsers = await User.find({})
return res.status(200).send(allUsers)
} catch (e) {
next(e)
return res.status(500).send('Internal server error!')
}
}

@@ -23,9 +23,9 @@ const getUser = async (req, res, next) => {
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) {
next(e)
return res.status(404).send('User not found!')
}
}

@@ -76,7 +76,7 @@ const updateUser = async (req, res, next) => {

return res.status(200).send('User updated successfully')
} catch (e) {
next(e)
return res.status(500).send(e.message)
}
}

@@ -91,7 +91,7 @@ const updateUserContacts = async (req, res, next) => {
}
return res.status(200).send('user contacts updated successfully')
} catch (e) {
next(e)
return res.status(500).send(e.message)
}
}

@@ -111,7 +111,7 @@ const deleteUser = async (req, res, next) => {

return res.status(204).send('Deleting user with id of ' + id)
} catch (e) {
next(e)
return res.status(500).send(e.message)
}
}


正在加载...
取消
保存