Skip to content

Commit a3200f8

Browse files
committed
minor update for finding tutorial
1 parent 2281fc5 commit a3200f8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/controllers/tutorial.controller.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ exports.findOne = (req, res) => {
5555

5656
Tutorial.findByPk(id)
5757
.then(data => {
58-
res.send(data);
58+
if (data) {
59+
res.send(data);
60+
} else {
61+
res.status(404).send({
62+
message: `Cannot find Tutorial with id=${id}.`
63+
});
64+
}
5965
})
6066
.catch(err => {
6167
res.status(500).send({

0 commit comments

Comments
 (0)