소스 검색

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)
}
}


Loading…
취소
저장