Creating your first filter

Sometimes, we may want to perform logic either before an action method is called or after an action method runs. In that case, we use filters, which we will be covering in this recipe.

Filters are basically handlers which encapsulate the common functionality or the cross-cutting concern. We just define them once and then apply them to the different controllers and action methods.

Get Go Web Development Cookbook 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.