February 2020
Intermediate to advanced
404 pages
8h 42m
English
Before jumping in, let's design the API specification table that shows the REST API signatures for various URL endpoints. Refer to the following table:
| Endpoint | Method | Description |
| /v1/shipment/id | GET | Get a shipment from ID |
| /v1/package/id | GET | Get a package from ID |
| /v1/package?weight=n | GET | Get a package with a given weight in grams |
| /v1/shipment | POST | Create a new shipment |
| /v1/package | POST | Create a new package |
To implement the preceding API, we need a main program that registers API routes to handler functions. Add one more file to our jsonstore project, like this:
touch jsonstore/main.go
In this program, we will try to implement the POST and GET endpoints for Package. We suggest implementing ...
Read now
Unlock full access