Summary
Go is widely used for developing RESTful clients and servers and this chapter illustrated how to program professional RESTful clients and servers in Go. Although you can develop a RESTful server using the Standard Go library, this can be a really tedious task. External packages such as gorilla/mux
, which was used in this chapter, and Gin can save you time by providing advanced features that would otherwise require lots of code when implemented with the functionality offered by the standard Go library.
Remember that defining a proper REST API and implementing a server and clients for it is a process that takes time and requires small adjustments and modifications.
Behind an efficient and productive RESTful service are properly defined JSON records and HTTP endpoints that support the desired operations. Given these two items, the Go code should offer support for the exchange of the JSON records between the server and the clients.
The next chapter is about code testing...