Ver código fonte

User endpoints fixes (#42)

pull/43/head
djordje.djoric 3 anos atrás
pai
commit
65a739f240
1 arquivos alterados com 6 adições e 6 exclusões
  1. 6
    6
      src/endpoints/user.js

+ 6
- 6
src/endpoints/user.js Ver arquivo

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


Carregando…
Cancelar
Salvar