about summary refs log tree commit diff
path: root/src/pronouns/web.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/pronouns/web.clj')
-rw-r--r--src/pronouns/web.clj12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/pronouns/web.clj b/src/pronouns/web.clj
index 2c348c0..6321198 100644
--- a/src/pronouns/web.clj
+++ b/src/pronouns/web.clj
@@ -47,10 +47,14 @@
      :headers {"Content-Type" "text/css"}
      :body (slurp (io/resource "pronouns.css"))})
 
-  (GET "/*" {params :params}
-       {:status 200
-        :headers {"Content-Type" "text/html"}
-        :body (pages/pronouns params)})
+  (GET "/*" {params :params headers :headers}
+       (if (= "application/json" (s/lower-case (get headers "accept")))
+         {:status 200
+          :headers {"Content-Type" "application/json"}
+          :body (pages/pronouns-json params pronouns-table)}
+         {:status 200
+          :headers {"Content-Type" "text/html"}
+          :body (pages/pronouns params pronouns-table)}))
 
   (ANY "*" []
        (route/not-found (slurp (io/resource "404.html")))))