clojurecup2015-mailhead/src/mailhead/routes/home.clj

26 lines
751 B
Clojure
Raw Normal View History

2015-12-05 01:03:29 +01:00
(ns mailhead.routes.home
(:require [mailhead.layout :as layout]
2015-12-06 11:13:11 +01:00
[mailhead.visualize :as v]
2015-12-05 11:31:48 +01:00
[compojure.core :refer [defroutes GET POST]]
2015-12-05 01:03:29 +01:00
[ring.util.http-response :refer [ok]]
[clojure.java.io :as io]))
(defn home-page []
2015-12-05 01:18:39 +01:00
(layout/render "home.html"))
2015-12-05 01:03:29 +01:00
(defn about-page []
(layout/render "about.html"))
2015-12-05 11:31:48 +01:00
(defn analyze-mailheader [mailheader]
2015-12-06 11:13:11 +01:00
(let [token (v/draw mailheader)]
;; TODO: Generate token
;; TODO: Generate image
;; TODO: Show image and other data on result.html
(layout/render "result.html" {:mailheader mailheader})))
2015-12-05 11:31:48 +01:00
2015-12-05 01:03:29 +01:00
(defroutes home-routes
(GET "/" [] (home-page))
2015-12-05 11:31:48 +01:00
(POST "/analyze" [mailheader] (analyze-mailheader mailheader))
2015-12-05 01:03:29 +01:00
(GET "/about" [] (about-page)))