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 Feb 27, 2023. It is now read-only.
I was involved in a lesson (as a teaching assistant) and came across the following scenario which confised the students (as well as me!)
In node week 2 we introduce a new variable albumsData which is an array of Beyonce albums.
When we make the request GET /albums/10, we ideally want to return the album with an id of 10. However, some students (and teachers) interpreted this as returning the album with an index of 10 (because albumsDatais an array).
In order to avoid this confusion (and to reflect real-world applications) we should change albumsData into a hash instead of an array, and return objects by their id instead of looping through albumsData and returning albums of their index.
The text was updated successfully, but these errors were encountered:
I think the array as a return to GET /<resource>s is more conventional than an object mapping the IDs. One thing that might help is making the IDs more obviously not indices, e.g. using UUIDs.
Hi thanks for reporting this, I just want to make note that this repo is for the old archived version of the syllabus. You'll likely get a better response if you move this over to https://github.com/codeyourfuture/syllabus 🙂
I was involved in a lesson (as a teaching assistant) and came across the following scenario which confised the students (as well as me!)
In node week 2 we introduce a new variable
albumsData
which is an array of Beyonce albums.When we make the request
GET /albums/10
, we ideally want to return the album with an id of 10. However, some students (and teachers) interpreted this as returning the album with an index of 10 (becausealbumsData
is an array).In order to avoid this confusion (and to reflect real-world applications) we should change
albumsData
into a hash instead of an array, and return objects by their id instead of looping throughalbumsData
and returning albums of their index.The text was updated successfully, but these errors were encountered: