Skip to content

Latest commit

 

History

History
89 lines (55 loc) · 4.57 KB

README.md

File metadata and controls

89 lines (55 loc) · 4.57 KB

Building Microservices with Go

I'm following along Nick Jackson's Building Microservices with Go series on YouTube.

Building Microservices with Go - Nick Jackson

I love his style of teaching.


Background

I started using Go since Apr 2021, but mostly with AWS SDK for Go V2 and Lambda in Go.

Come to think of it, my previous project was also a serverless one on AWS, but with Javascript.

So last time I developed commerical container-based system was around 2019-2020. And it was a monolith server backed by TypeScript, Node.js, PostgreSQL, and of course, Kubernetes. We ran into the textbook Monolith Hell, a prevailing architecture struggle described in Chris Richardson's book Microservices Patterns. I'm reading this book by the way.

Microservices Patterns - Chris Richardson

Goals

  • learn more Go
  • brush up building REST APIs
  • learn gRPC
  • last but not least: learn Nick Jackson's style of teaching

Logs

  • 2021-09-12: init commit!
  • 2021-09-12: ep-01 hello world http server
  • 2021-09-14: ep-02 refactor to http handler modules. shut down server gracefully
  • 2021-09-14: ep-03 basic REST api
  • 2021-09-16: ep-04 basic REST api CRUD
  • 2021-09-26: ep-05 use Gorilla Mux to bootstrap REST routes. it is very similar to express.js.
  • 2021-10-02: ep-06 use Go validator to validate REST request input. it is a different approach from joi, where the validation rules are tied with HTTP handler middleware.
  • 2021-10-04: ep-07 generate Swagger API docs.
  • 2021-10-09: ep-08 generate API client from Swagger spec.
  • 2021-10-09: ep-09 more gorilla handler/middleware.

Tricks

  • auto-compile and re-start the server on file changes. unlike Javascript, Go community doesn't seem to have a go-to solution.

    # https://techinscribed.com/5-ways-to-live-reloading-go-applications/
    
    npx nodemon --exec go run main.go --signal SIGTERM
  • run go tests recursively in all sub directories

    go test -v ./...

other references I read

open questions