Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Build a REST API With Express Completing and Testing the API Connecting the API and Database

Eusebiu Gagea
Eusebiu Gagea
14,127 Points

.push(req.body)

I can't get it why we need to use push(req.body) on minute 13.. Help me, please!

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

Since each question can have more than one answer you'll have a list of them. More specifically an array. When we add a new answer in the POST route, we'll push that answer (which should be the body of the request) to the end of the rest.

Eusebiu Gagea
Eusebiu Gagea
14,127 Points

Thank you so much! I thought that the push method is sth else than the regular function for arrays. I can get it now.