mirror of
https://github.com/vale981/lack
synced 2025-03-04 08:51:41 -05:00
to-app.
This commit is contained in:
parent
5f2ffe52fe
commit
626e527702
2 changed files with 5 additions and 2 deletions
|
@ -7,4 +7,5 @@
|
|||
:version "0.1"
|
||||
:author "Eitaro Fukamachi"
|
||||
:license "LLGPL"
|
||||
:depends-on (:lack-component)
|
||||
:components ((:file "src/middleware/mount")))
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
(in-package :cl-user)
|
||||
(defpackage lack.middleware.mount
|
||||
(:use :cl)
|
||||
(:import-from :lack.component
|
||||
:to-app)
|
||||
(:export :*lack-middleware-mount*))
|
||||
(in-package :lack.middleware.mount)
|
||||
|
||||
|
@ -12,13 +14,13 @@
|
|||
(cond
|
||||
((string= path-info path)
|
||||
(setf (getf env :path-info) "/")
|
||||
(funcall mount-app env))
|
||||
(funcall (to-app mount-app) env))
|
||||
((and (< len (length path-info))
|
||||
(string= path-info path :end1 len)
|
||||
(char= (aref path-info len) #\/))
|
||||
(setf (getf env :path-info)
|
||||
(subseq path-info (length path)))
|
||||
(funcall mount-app env))
|
||||
(funcall (to-app mount-app) env))
|
||||
(t
|
||||
(funcall app env)))))))
|
||||
"Middleware for attaching another Lack application on a specific URL")
|
||||
|
|
Loading…
Add table
Reference in a new issue