diff options
author | Morgan <m@morganastra.me> | 2015-03-03 10:30:48 +0000 |
---|---|---|
committer | Morgan <m@morganastra.me> | 2015-03-03 10:45:18 +0000 |
commit | 945fa4e9a618f4ff6ab737918806609cb03b1219 (patch) | |
tree | d727a02a1a112d0ddaecabd84308131370126262 /src/pronouns | |
parent | 2347c4b1a378e72472bb90e90592ccef89d1e10f (diff) |
Really ugly template thing, also formatting
Diffstat (limited to 'src/pronouns')
-rw-r--r-- | src/pronouns/web.clj | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/pronouns/web.clj b/src/pronouns/web.clj index 547ebfc..24588c0 100644 --- a/src/pronouns/web.clj +++ b/src/pronouns/web.clj @@ -13,6 +13,15 @@ (def config {:default-server-port 5000}) +(defn render-examples-page + [subject object possessive-determiner possessive-pronoun reflexive] + (s/join "\n" + [(str subject " went to the park") + (str "I went with " object) + (str subject " brought " possessive-determiner " frisbee") + (str "at least I think it was " possessive-pronoun) + (str subject " threw it to " reflexive)])) + (defroutes app-routes (GET "/" [] {:status 200 @@ -21,7 +30,15 @@ (GET "/:subject/:object/:possessive-determiner/:possessive-pronoun/:reflexive" {params :params} {:status 200 :headers {"Content-Type" "text/plain"} - :body (str (:subject params) " goes to the park")}) + ;; ew this is super gross there's certainly a better way + :body (let [{:keys + [subject object possessive-determiner possessive-pronoun reflexive]} + params] + (render-examples-page subject + object + possessive-determiner + possessive-pronoun + reflexive))}) (ANY "*" [] (route/not-found (slurp (io/resource "404.html"))))) @@ -40,8 +57,8 @@ trace/wrap-stacktrace)) (defn -main [] - (let [port (Integer. (env :port (:default-server-port config))) - ] + (let [port (Integer. (:port env + (:default-server-port config)))] (jetty/run-jetty app {:port port}))) ;; For interactive development: |