In this chapter, we first looked into what middleware is, exactly, including how middleware processes a request and response. We then explored middleware code with a few practical examples. After that, we saw how to chain our middleware by passing one middleware to another. Then, we used a package called Alice
for intuitive chaining. We also took a look at the Gorilla handlers middleware for logging. Next, we learned what an RPC is and how an RPC server and client can be built. After that, we explained what a JSON RPC is, and we saw how one can create a JSON RPC using Gorilla toolkit. We introduced many third-party packages for middleware and RPC, with examples.
In the next chapter, we are going to explore few famous web frameworks those further simplify the REST API creation. They have batteries included by possessing inbuilt middleware and HTTP routers.