Переглянути джерело

User endpoints fixes

pull/42/head
Djordje Djoric 3 роки тому
джерело
коміт
20de2ef926
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)
}
}


Завантаження…
Відмінити
Зберегти