- Run the datastore emulator locally:
gcloud components install cloud-datastore-emulator
gcloud beta emulators datastore start --project=acme-books --host-port=localhost:3031 --no-store-on-disk
- Build the code
go build ./...
- Start the server
go run .
- See the current book list
http://localhost:3030/books
- Check a single book's details using its id/key
http://localhost:3030/books/4
- Refactor the datastore client usage to avoid duplicate code (see main.go and library.go)
- Order the results for the book list by author name
- Allow filtering to be applied to the book list (via a query parameter)
- Add a new end point to rent or return a book
request:
PUT: http://localhost:3030/:id/borrow
PUT: http://localhost:3030/:id/return
response:
204 if ok
400 if invalid id
400 if already borrowed
400 if not borrowed when returned
- Add a new end point to add a book to the library
request:
POST: http://localhost:3030/book
Body: Book in JSON format
response:
200 + Book object including generated key
- Raise a PR and have it peer reviewed by a fellow Gohorter