You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.
When trying to create the controllers for creating new todos I get the following error: "TypeError: Cannot read property 'create' of undefined" when calling the API from Postman.
The part of the code where the error happens:
module.exports = {
create(req, res) {
return Todo
.create({ # This is the problem part
title: req.body.title,
})
.then(todo => res.status(201).send(todo))
.catch(error => res.status(400).send(error));
},
};
I'm not super familiar with ES6 syntax so I really don't know if I need to refactor this code
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When trying to create the controllers for creating new todos I get the following error: "TypeError: Cannot read property 'create' of undefined" when calling the API from Postman.
The part of the code where the error happens:
module.exports = {
create(req, res) {
return Todo
.create({ # This is the problem part
title: req.body.title,
})
.then(todo => res.status(201).send(todo))
.catch(error => res.status(400).send(error));
},
};
I'm not super familiar with ES6 syntax so I really don't know if I need to refactor this code
The text was updated successfully, but these errors were encountered: