The Blog of Boban Acimovic
  • Blog
  • Categories
  • Tags
  • Series
  • Links
  • About
  • Contact
  • RSS
  • Terms
  • Privacy

Http

Carpe Diem

go

How to write complex HTTP middlewares in Go

Lot of the tutorials on the Web show different ways of writing Go HTTP middlewares, but most of them use functional approach meaning using functions that get dependencies as parameters and return HTTP handler function or handler. There is nothing wrong about this, but it can be quite messy to write a complex middlewares like database based authentication and authorization or simply middlewares which have lot of dependencies. In this article I am going to explain how to use more object oriented way of writing such middlewares. Let’s start with the basic object oriented middleware example:

  • Boban Acimovic
Boban Acimovic 13 November 2022 • 3 min read
The Blog of Boban Acimovic © 2022
Latest Posts