jimmacur / hang_in_there_api

1 stars 0 forks source link

Sorting Results by Query Parameters #9

Closed jimmacur closed 2 months ago

jimmacur commented 2 months ago

Sorting Results by Query Parameters This endpoint should:

return all objects in the database in the appropriately sorted order, based on the query params received. allow the user to specify a ‘sort’ query parameter: for posters, the user can send ?sort=asc and it will return records sorted by created_at date, ascending for posters, the user can send ?sort=desc and it will return records sorted by created_at date, descending Request examples: GET /api/v1/posters?sort=asc GET /api/v1/posters?sort=desc The JSON response will always be an array of objects, even if there are zero results.

Example JSON response for GET /api/v1/posters?sort=asc