Skip to content

still working on app.put#24

Open
scl9087 wants to merge 3 commits intopce-uw-jscript400:masterfrom
scl9087:master
Open

still working on app.put#24
scl9087 wants to merge 3 commits intopce-uw-jscript400:masterfrom
scl9087:master

Conversation

@scl9087
Copy link

@scl9087 scl9087 commented Jul 10, 2019

No description provided.


if (!name) {
const message = `Could not find vegetable with name of ${name}`
next({ status: 404, message })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually don't want to stop the request here. If there's no name, that's ok, we should return all of the vegetables.

let veggie;
for(let i = 0; i < data.vegetables.length; i++) {
if (vegetables[i].id === id) {
veggie.name = req.body.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unable to get through this route. I think the problem is that you've declared veggie up above, which means its value is set to undefined. You are then trying to assign a property of .name to it. This will result in a failure.


})

// Fruits
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you're missing the PUT method here..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants