Created
May 14, 2015 17:16
-
-
Save laser/f53d15c274a7a247fff3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function create(req, res, next) { | |
Placement.create(req.body, function (err, placement) { | |
if (err) { | |
if (err instanceof RecordNotFound) { | |
res.status(status(404)).send(); | |
} | |
else if (err instanceof ValidationFailed) { | |
res.status(status(400)).send(); | |
} | |
else { | |
// internal error | |
res.status(status(500)).send(); | |
} | |
} | |
else { | |
res | |
.status(status['Created']) | |
.json(placement); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment