Skip to content
Browse files

appended README abount Middleware.

  • Loading branch information...
1 parent 0d5f07b commit 5c0cd38616edf21a92ad8bcd010c60ba47f9968a @fukamachi committed Jan 14, 2011
Showing with 19 additions and 0 deletions.
  1. +19 −0 README.markdown
View
19 README.markdown
@@ -18,6 +18,25 @@ Now works on Hunchentoot only.
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
* Hunchentoot

0 comments on commit 5c0cd38

Please sign in to comment.
Something went wrong with that request. Please try again.