(in-package :cl-user)
(defpackage clack.middleware.example
(:use :cl :clack)
(:export :<clack-middleware-example>))
(in-package :clack.middleware.example)
(defclass <clack-middleware-example> (<middleware>) ())
(defmethod call ((this <clack-middleware-example>) env)
;; pre-processing `env`
(let ((res (call-next this env)))
;; post-processing `res`
res)) Clack.Middleware is the base class to write Clack Middleware.
All you have to do is to inherit from <middleware> and then implement the callback call method to do the actual work.
Middleware is similar to ':around' method of CLOS. You can delegate some processes to Application (or next Middleware) to call call-next.
Author: Eitarow Fukamachi (e.arrows@gmail.com)
Class for Clack Middleware.
Call next middleware or application.
Compose `this` and the given application or middleware instance into one function. This function takes a request plist.