5. Building Microservices in Go

“The golden rule: can you make a change to a service and deploy it by itself without changing anything else?”

Sam Newman, Building Microservices

Every service you build should be a microservice, and, as we’ve discussed earlier in the book, we generally disagree with using the prefix micro at all. In this chapter we’re going to be building a service, but this chapter is as much about the process as it is about the end result.

We’ll start by following the practice of API First, designing our service’s RESTful contract before we write a single line of code. Then, when it does come time to write code, we’re going to start by writing tests first. By writing small tests that go from failure to passing, we will gradually ...

Get Cloud Native Go: Building Web Applications and Microservices for the Cloud with Go and React now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.