Permalink
Browse files

fix order of defining functions in ow.webapp

  • Loading branch information...
olivermg committed Feb 11, 2019
1 parent 6a0052a commit b08de89464e8d1bb1455e344ba712184acf534d9
Showing with 8 additions and 8 deletions.
  1. +8 −8 src/ow/webapp.clj
@@ -3,6 +3,14 @@
[org.httpkit.server :as hk]
[ow.app.lifecycle :as owl]))

(defn- app-handler [{:keys [routes resources] :as this} req]
(let [{:keys [handler]} (some-> (b/match-route routes (:uri req))
(update :handler #(get resources %)))]
(if handler
(handler req)
{:status 404
:body "resource not found"})))

(defrecord Webapp [routes resources middleware httpkit-options
server]

@@ -24,14 +32,6 @@
(assoc this
:server nil)))

(defn- app-handler [{:keys [routes resources] :as this} req]
(let [{:keys [handler]} (some-> (b/match-route routes (:uri req))
(update :handler #(get resources %)))]
(if handler
(handler req)
{:status 404
:body "resource not found"})))

(defn webapp [routes resources & {:keys [middleware httpkit-options]}]
(map->Webapp {:routes routes
:resources resources

0 comments on commit b08de89

Please sign in to comment.