When you're designing a server-side API, no one is going to know how to interact with it unless you tell them. Are you going to force the front-end developers, mobile developers, or other back-end service teams to sift through your code and reverse engineer your API?
Of course not! You're a good person. You're going to write documentation.
We've talked a lot about how your REST API should follow conventions as much as possible. That said, the conventions are not enough. You still need to document your endpoints. Without documentation, no one will know:
One type of endpoint that's nearly impossible to interact with without documentation is a plural GET endpoint, that is, an endpoint that returns a list of resources. They often have different sorting, filtering, and pagination features.
For example:
GET http://localhost:8080/api/chirps?author_id=1
Continue sorting the chirps by created_at in ascending order.
Run and submit the CLI tests.
The http.Request struct has a way to grab the query parameters from the URL:
s := r.URL.Query().Get("author_id")
// s is a string that contains the value of the author_id query parameter
// if it exists, or an empty string if it doesn't