rcos / observatory-server

A project tracking dashboard for Rensselaer Center for Open Source
https://rcos.io
MIT License
14 stars 51 forks source link

User controller actions must return JSON with HTTP status #713

Closed aeksco closed 6 years ago

aeksco commented 6 years ago

Encapsulates issues: #706 | #707 | #708 | #709 | #712

The User module's controller (/server/api/user/user.controller.js) methods return only HTTP status codes (i.e. 200, 301, 404, 500). These responses should changed to return, at the very least, a simple JSON representation of what has occurred.

The following statements in user.controller.js should be updated:

Before:

res.send(500, err);

res.send(200);

res.send(403);

After:

res.status(500).json({ error: err })

res.status(200).json({ success: true })

res.status(403).json({ forbidden: true })

We will likely update these statements to return the data that has changed as a result of the API call - this issue will pave the way for those changes.

aeksco commented 6 years ago

Resolved