Implementing an endpoint to retrieve a note by id using HTTP verb GET
To retrieve a record of Note
, we will implement an endpoint that meets specific requirements. Let's make a list of these requirements to understand what the request and response should look like for our endpoint that returns a Note
when an id
argument is provided.
The request is expected to meet the following criteria:
- The HTTP method will be
GET
. - The HTTP route will be
/notes/:id
. - The resource URL will have the
id
argument of theNote
we are trying to retrieve.
The response is expected to meet the following criteria:
- Select
Note
from the database using the built-inorm
-based syntax whoseid
is the same as theid
argument present in the resource URL. - When the
id
argument that is present in the resource URL does not match any of the records in the database, the following will occur:- The response body will have a
CustomResponse
struct encoded into JSON with a reasonable message...
- The response body will have a