Middleware chaining

The Echo framework provides three mechanisms for inserting middleware into your request-processing pipeline. The Echo instance's Use(MiddlewareFunc) helper method is the most common way to add normal post-routing middleware. As you may recall, for flexibility we showed you how to use the Group(string) Echo method to organize routes. The Use(MiddlewareFunc) helper method is also available on Group instances so that you can apply middleware functions only to particular groupings of routes as well. Use tells the Echo instance, or grouping instance, that we wish to insert the middleware specified as a parameter into our middleware chain. It should be made clear that the order of your Use calls is very important. The order ...

Get Echo Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.