Go Tutorial #18: Middleware and JWT Authentication
In the previous tutorial, you learned how to test Go code. Now it is time to add authentication to your API. Middleware is the standard way to handle cross-cutting concerns like authentication, logging, and CORS. What is Middleware? Middleware is a function that runs before (or after) your handler. It sits between the request and the handler: Request → Middleware 1 → Middleware 2 → Handler → Response Common uses for middleware: ...