Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Future-proof your Go API - GothamGo 2018

115 views

Published on

These are slides from my talk at GothamGo 2018 in New York, NY.

--

Building and launching an API in Go is great. Maintaining, not so much. I’ll review strategies for testing and versioning your Go API.

Published in: Software
  • Be the first to comment

Future-proof your Go API - GothamGo 2018

  1. 1. Future-proof your Go API @stevekaliski
  2. 2. Overview 1. Introductions 2. “Future-Proof” 3. Testing 4. Versioning
  3. 3. 👋 Hi!
  4. 4. Future-proof?
  5. 5. Future-Proof - Application - Programming - Interface
  6. 6. Future-Proof - Application - Programming → Less maintenance - Interface → Increased stability
  7. 7. Why Go? - Standard library (net/http, testing) - Type + Interfaces - Go Community + API Frameworks
  8. 8. Testing
  9. 9. net/http/httputil func DumpResponse(resp *http.Response, body bool) ([]byte, error)
  10. 10. abide func AssertHTTPResponse(t *testing.T, id string, w *http.Response) type Assertable interface {
 String() string
 }
  11. 11. Testing - Summary - net/http(/httputil, /httptest) = 👍 - Integrate into existing testing workflow = 👍 - httputil.DumpResponse as catchall = 👍 Future Proof = observability into interface
  12. 12. Versioning
  13. 13. pinned type Version type Change type Versionable interface {
 Data() map[string]interface{}
 } func Apply(v *Version, obj Versionable)
  14. 14. Versioning - Summary - Use `Interface` to support any object = 👍 - Integrate into testing for observability = 👍
  15. 15. Thanks! ● twitter.com/stevekaliski ● github.com/sjkaliski ● sjkaliski@gmail.com
  16. 16. Resources - github.com/beme/abide - github.com/sjkaliski/pinned - github.com/sjkaliski/gotham-go-examples

×