Просмотр исходного кода

User endpoints fixes (#42)

pull/43/head
djordje.djoric 3 лет назад
Родитель
Сommit
65a739f240
1 измененных файлов: 6 добавлений и 6 удалений
  1. 6
    6
      src/endpoints/user.js

+ 6
- 6
src/endpoints/user.js Просмотреть файл

const allUsers = await User.find({}) const allUsers = await User.find({})
return res.status(200).send(allUsers) return res.status(200).send(allUsers)
} catch (e) { } catch (e) {
next(e)
return res.status(500).send('Internal server error!')
} }
} }


return res.status(404).send("User with the id of: " + id + " doesnt exist") 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) { } catch (e) {
next(e)
return res.status(404).send('User not found!')
} }
} }




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


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




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



Загрузка…
Отмена
Сохранить