Elson TC
Feb 1, 2022

Removing the lines 17 and 19 on first solution would do the trick. Honestly, in the real world you could have API endpoints to support various type of requests:

/people => to get it all
/people/:id => to get a single one
/people?ids= => to get comma separated specified id

If I need to request 1000 people by specific id I would extend the server API and not the client way to request things. Thats because you are still making 1000 requests instead of a single one which is not ideal neither for the client or server.

How would handle error? Do you need to reformat data on receiving them?

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Elson TC
Elson TC

Written by Elson TC

Software Engineer sharing knowledge, experience, and perspective from an employee and personal point of view.

Responses (2)

Write a response