Skip to content

Instantly share code, notes, and snippets.

@PatrickKalkman
Created January 11, 2020 16:01
Show Gist options
  • Save PatrickKalkman/8c298ff4525fadbe3dfe02969f8a0810 to your computer and use it in GitHub Desktop.
Save PatrickKalkman/8c298ff4525fadbe3dfe02969f8a0810 to your computer and use it in GitHub Desktop.
Part of the JobController that saves a job using Mongoose
jobController.addJob = function addJob(req, reply) {
const job = new Job(req.body);
job.status = constants.WORKFLOW_STATUS.NEW;
job.save(function(err, job) {
if (!err) {
reply.send(job);
} else {
reply.badRequest(err);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment