Skip to content
Permalink
Browse files
final
  • Loading branch information
caracold committed Apr 23, 2020
1 parent 819e8c8 commit d7d803a02ef207ecf6846d3e5a77af8c5a501d72
Showing 1 changed file with 3 additions and 12 deletions.
@@ -104,21 +104,12 @@ exports.getMessage = (req, res, next) => {
Message.findById(id)
.exec()
.then(doc => {
console.log(doc);
if (doc) {
const response = {
items: doc.map(doc => {
return {
_id: doc._id,
sender: doc.sender,
title: doc.title,
content: doc.content
}
})
}
res.status(200).json(response);
res.status(200).json(doc);
} else {
res.status(404).json({
message: 'Message not found.'
message: 'Message ID not found.'
})
}
})

0 comments on commit d7d803a

Please sign in to comment.