A common feature in APIs is the ability to sort the response by a field. We don't want to add additional endpoints for every possible sort order, so we'll use a query parameter instead.
Update the GET /api/chirps endpoint. It should accept an optional query parameter called sort. It can have 2 possible values:
asc - Sort the chirps in the response by created_at in ascending orderdesc - Sort the chirps in the response by created_at in descending orderasc is the default if no sort query parameter is provided.
Keep it simple! You can just sort the chirps in-memory using sort.Slice.
Run and submit the CLI tests.
GET http://localhost:8080/api/chirps?sort=ascGET http://localhost:8080/api/chirps?sort=descGET http://localhost:8080/api/chirps