For fetching a list of items in the shopping cart, we will register the /restapi/get-cart-items endpoint:
r.Handle("/restapi/get-cart-items", endpoints.GetShoppingCartItemsEndpoint(env)).Methods("GET")
This endpoint will be handled by the GetShoppingCartItemsEndpoint handler function. This endpoint is responsible for encoding the shopping cart as JSON encoded data and providing it to the client-side application. Note that we use the HTTP GET method to call this endpoint.