FAQ: Learn Express Routes - Adding Animals Routes

This community-built FAQ covers the “Adding Animals Routes” exercise from the lesson “Learn Express Routes”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn Express

FAQs on the exercise Adding Animals Routes

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

You guys, need to include a link or text explaining what the methods do or else we are guessing, what there parameters are or what they return.

4 Likes

@codecademy I agree with @rybohii . This whole chapter threw express.utils module methods at us from out of the blue. At least the utils module is where I think they came from. I will have to look this up on my own. But this made the exercises more confusing since I was not familiar with the logic and syntax of the utils methods. I understand the express routes logic and syntax, and that is the main purpose of the lesson. IMO this was an unnecessary curveball in the curriculum.
#justBitching :grimacing:

4 Likes

I believe this is the exercise link

I actually have the same question… well need help figuring out the GET method for an array!

When deleting animals by id, If you use the the .filter() method instead of the .splice() method, the animal would not be deleted from the the array. Can anyone explain what i am doing wrong.

app.delete('/animals/:id', (req,res,next) => { const data = req.params; const indexOfElm = getIndexById(data.id, animals) if(indexOfElm !== -1){ let filteranimals = animals.filter(elm => elm.id !== data.id) console.log(filteranimals) res.status(204).send("") }else{ res.status(404).send("Element not Found") } })