diff options
Diffstat (limited to 'src/pronouns/web.clj')
-rw-r--r-- | src/pronouns/web.clj | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/pronouns/web.clj b/src/pronouns/web.clj index 23ac603..4ec1788 100644 --- a/src/pronouns/web.clj +++ b/src/pronouns/web.clj @@ -25,13 +25,17 @@ (GET "/pronouns.css" {params :params} {:status 200 - :headers {"Content-Type" "text/css"} - :body (slurp (io/resource "pronouns.css"))}) + :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) pronouns-table)}) + (GET "/*" {params :params headers :headers} + (if (= "application/json" (get headers "accept")) + {:status 200 + :headers {"Content-Type" "application/json"} + :body (pages/pronouns (:* params) pronouns-table :json)} + {:status 200 + :headers {"Content-Type" "text/html"} + :body (pages/pronouns (:* params) pronouns-table :html)})) (ANY "*" [] (route/not-found (slurp (io/resource "404.html"))))) |