remove wrap-base, just put the optional wrap-reload under http-server
i don't _really_ want to encourage the use of wrap-base as i think it is usually the wrong place to add middleware to. instead adding a placeholder :middleware list to the reitit ring-handler as the intended alternative place for "global" middleware that needs to be applied regardless of a reitit route match
This commit is contained in:
parent
aa1aa76bbf
commit
473bed92df
|
@ -131,15 +131,15 @@
|
||||||
coercion/coerce-request-middleware ; coercing request parameters
|
coercion/coerce-request-middleware ; coercing request parameters
|
||||||
multipart/multipart-middleware ; multipart
|
multipart/multipart-middleware ; multipart
|
||||||
]}})
|
]}})
|
||||||
(ring/routes
|
|
||||||
(ring/create-default-handler))))
|
|
||||||
|
|
||||||
(defn wrap-base
|
(ring/routes
|
||||||
[handler]
|
(ring/create-default-handler))
|
||||||
(as-> handler h
|
|
||||||
(if (:dev? config) (wrap-reload h) h)
|
; add any top-level middleware here that will be applied to the *entire* handler,
|
||||||
; TODO: other base middleware here
|
; regardless of the route matched, if any. (most of the time you'd want to use
|
||||||
))
|
; the :middleware list found above though...)
|
||||||
|
{:middleware []}))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -168,7 +168,8 @@
|
||||||
:or {port 8080
|
:or {port 8080
|
||||||
bind "0.0.0.0"}} (:http-server config)
|
bind "0.0.0.0"}} (:http-server config)
|
||||||
server (http-kit/run-server
|
server (http-kit/run-server
|
||||||
(wrap-base #'handler)
|
(as-> #'handler h
|
||||||
|
(if (:dev? config) (wrap-reload h) h))
|
||||||
{:port port
|
{:port port
|
||||||
:ip bind
|
:ip bind
|
||||||
:server-header nil
|
:server-header nil
|
||||||
|
|
Loading…
Reference in a new issue