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
We want to build an endpoint that allows a user to join a course as a learner. This endpoint can be GET learner/search, with search, page, and size query parameters. The course data can be sorted in ascending alphabetical order based on the course name.
Steps
Build an endpoint that returns all courses that a user can join based on a search value, page number, and page size. The endpoint should return all of the information about a course that is found in MongoDB, except the admin_id and approved fields.
Make sure to add the appropriate middleware for checking if the client requesting this endpoint can access the courses.
Write Jest Unit Tests!!! I would test a couple of the scenarios listed in the Example API Calls with our Mock Database.
Example API Calls
Let's suppose that the courses are:
English
Spanish
French
German
Hindi
GET learner/search?search='' returns English, French, German, Hindi, Spanish GET learner/search?page=1&size=2 returns English, French GET learner/search?search=''&page=2&size=3 returns German, Hindi GET learner/search?search='E' returns English
Notice how the page is 1-based and size courses aren't always returned.
Goals
We want to build an endpoint that allows a user to join a course as a learner. This endpoint can be
GET learner/search
, withsearch
,page
, andsize
query parameters. The course data can be sorted in ascending alphabetical order based on the course name.Steps
admin_id
andapproved
fields.Don't forget to:
Example API Calls
Let's suppose that the courses are:
GET learner/search?search=''
returnsEnglish, French, German, Hindi, Spanish
GET learner/search?page=1&size=2
returnsEnglish, French
GET learner/search?search=''&page=2&size=3
returnsGerman, Hindi
GET learner/search?search='E'
returnsEnglish
Notice how the page is
1-based
andsize
courses aren't always returned.Resources
The text was updated successfully, but these errors were encountered: