Summary
In this chapter, we first looked into what middleware is and how middleware processes a request and response. We then explored the middleware code, with a few practical examples. After that, we saw how to chain many middleware, one after the other. A package such as alice can be used for intuitive chaining. A package from the Gorilla toolkit, gorilla/handlers, provides various middleware for logging, compression, and Cross-Origin Resource Sharing (CORS).
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 to create a JSON-RPC using the Gorilla toolkit. We introduced many third-party packages for middleware and RPC along the way.
In the next chapter, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access