diff options
author | Morgan Astra <m@morganastra.me> | 2018-11-16 14:14:13 -0800 |
---|---|---|
committer | Morgan Astra <m@morganastra.me> | 2018-11-16 14:14:13 -0800 |
commit | 759e1279d103ebebd3081fa10d9f3622f7a9f2b8 (patch) | |
tree | 1f0c4d912571b1c6ba621d90243e3750d1b39840 /src/pronouns/web.clj | |
parent | 647c396d49b0091d5f1e077e2d0b8c275860ebe0 (diff) | |
parent | b0eac61d82c9e03cf9b2eb646b3acabb49c02acb (diff) |
Merge branch 'json-api' of https://github.com/SomeHats/pronoun.is into SomeHats-json-api
Diffstat (limited to 'src/pronouns/web.clj')
-rw-r--r-- | src/pronouns/web.clj | 12 |
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"))))) |