Skip to content

Instantly share code, notes, and snippets.

@amandeepmittal
Created December 3, 2018 04:35
Show Gist options
  • Save amandeepmittal/41ba35f9fccb07bdccca7026ee533242 to your computer and use it in GitHub Desktop.
Save amandeepmittal/41ba35f9fccb07bdccca7026ee533242 to your computer and use it in GitHub Desktop.
const TodoItem = require('../models').TodoItem;
module.exports = {
create(req, res) {
return TodoItem.create({
content: req.body.content,
todoId: req.params.todoId
})
.then(todoItem => res.status(201).send(todoItem))
.catch(error => res.status(400).send(error));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment