Skip to content

Commit

Permalink
fix: Change to res.sendStatus(status) because express deprecated res.…
Browse files Browse the repository at this point in the history
…send(status)

see: #10
  • Loading branch information
sujinleeme committed Jul 1, 2018
1 parent 507c262 commit 7f70df5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions server/controllers/inputAudio.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ module.exports = {
const saveInputAudio = (obj) => {
new InputAudio(obj).save((err, audio) => {
if (err)
res.send(err)
res.sendStatus(err)
else if (!audio)
res.send(400)
res.sendStatus(400)
else {
return InputAudio.addAuthor(req.body.author_id).then(_audio =>
res.send(_audio)
res.sendStatus(_audio)
)
}
next()
Expand Down
12 changes: 6 additions & 6 deletions server/controllers/user.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ module.exports = {
addUser: (req, res, next) => {
new User(req.body).save((err, newUser) => {
if (err)
res.send(err)
res.sendStatus(err)
else if (!newUser)
res.send(400)
res.sendStatus(400)
else
res.send(newUser)
res.sendStatus(newUser)
next()
})
},

getUser: (req, res, next) => {
User.findById(req.params.id).then((err, user) => {
if (err)
res.send(err)
res.sendStatus(err)
else if (!user)
res.send(404)
res.sendStatus(404)
else
res.send(user)
res.sendStatus(user)
next()
})
},
Expand Down

0 comments on commit 7f70df5

Please sign in to comment.