Skip to content

Commit

Permalink
appended README abount Middleware.
Browse files Browse the repository at this point in the history
  • Loading branch information
fukamachi committed Jan 13, 2011
1 parent 0d5f07b commit 5c0cd38
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.markdown
Expand Up @@ -18,6 +18,25 @@ Now works on Hunchentoot only.


Now access [http://localhost:8080/](http://localhost:8080/) and Clack show you "Hello, Clack!". Now access [http://localhost:8080/](http://localhost:8080/) and Clack show you "Hello, Clack!".


## Middleware

(defpackage simple-app
(:use :cl :clack))

(in-package :simple-app)

(defclass <simple-middleware> (<middleware>) ())
(defmethod call ((mw <simple-middleware>) env)
"Hello, Clack Middleware!")
(defmethod build ((mw <middleware>) app)
(lambda (env)
(format nil "Application: ~A~%Middleware: ~A"
(funcall app) (call mw env))))

(defvar mw (make-instance '<simple-middleware>))

(run (build mw app))

## Dependency ## Dependency


* Hunchentoot * Hunchentoot
Expand Down

0 comments on commit 5c0cd38

Please sign in to comment.