|
|
|
@ -15,7 +15,6 @@ |
|
|
|
[notehub.storage :as storage] |
|
|
|
[notehub.storage :as storage] |
|
|
|
[cheshire.core :refer :all])) |
|
|
|
[cheshire.core :refer :all])) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; Creates the main html layout |
|
|
|
; Creates the main html layout |
|
|
|
(defn layout |
|
|
|
(defn layout |
|
|
|
[title & content] |
|
|
|
[title & content] |
|
|
|
@ -35,7 +34,6 @@ |
|
|
|
(if-not (get-setting :dev-mode) (include-js "/js/google-analytics.js"))] |
|
|
|
(if-not (get-setting :dev-mode) (include-js "/js/google-analytics.js"))] |
|
|
|
[:body {:onload "onLoad()"} content])) |
|
|
|
[:body {:onload "onLoad()"} content])) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn md-node |
|
|
|
(defn md-node |
|
|
|
"Returns an HTML element with a textarea inside |
|
|
|
"Returns an HTML element with a textarea inside |
|
|
|
containing the markdown text (to keep all chars unescaped)" |
|
|
|
containing the markdown text (to keep all chars unescaped)" |
|
|
|
@ -91,7 +89,6 @@ |
|
|
|
:body content}) |
|
|
|
:body content}) |
|
|
|
|
|
|
|
|
|
|
|
(defroutes api-routes |
|
|
|
(defroutes api-routes |
|
|
|
|
|
|
|
|
|
|
|
(GET "/" [] (layout (get-message :api-title) |
|
|
|
(GET "/" [] (layout (get-message :api-title) |
|
|
|
(md-node :article (slurp "API.md")))) |
|
|
|
(md-node :article (slurp "API.md")))) |
|
|
|
|
|
|
|
|
|
|
|
@ -205,4 +202,12 @@ |
|
|
|
(route/not-found (response 404))) |
|
|
|
(route/not-found (response 404))) |
|
|
|
|
|
|
|
|
|
|
|
(def app |
|
|
|
(def app |
|
|
|
(handler/site app-routes)) |
|
|
|
(let [handler (handler/site app-routes)] |
|
|
|
|
|
|
|
(fn [request] |
|
|
|
|
|
|
|
(if (get-setting :dev-mode) |
|
|
|
|
|
|
|
(handler request) |
|
|
|
|
|
|
|
(try (handler request) |
|
|
|
|
|
|
|
(catch Exception e |
|
|
|
|
|
|
|
(do |
|
|
|
|
|
|
|
;TODO (log e) |
|
|
|
|
|
|
|
(response 500)))))))) |
|
|
|
|