Implementing Gravatar
Gravatar is a web service that allows users to upload a single profile picture and associate it with their e-mail address in order to make it available from any website. Developers, like us, can access these images for our application just by performing a GET
operation on a specific API endpoint. In this section, we will look at how to implement Gravatar rather than use the picture provided by the auth service.
Abstracting the avatar URL process
Since we have three different ways of obtaining the avatar URL in our application, we have reached the point where it would be sensible to learn how to abstract the functionality in order to cleanly implement the options. Abstraction refers to a process in which we separate the idea of something from its specific implementation. The http.Handler
method is a great example of how a handler will be used along with its ins and outs, without being specific about what action is taken by each handler.
In Go, we start to describe our...