A web service is nothing more than a simple Go program that binds to a specific HTTP address and port and serves requests, so we get to use all our command-line tool writing knowledge and techniques.
We also want to ensure that our
main function is as simple and modest as possible, which is always a goal of coding, especially in Go.
Before writing our
main function, let's look at a few design goals of our API program:
We want the program to gracefully shut down when we terminate it, allowing the in-flight requests (requests ...