  (:use [hiccup core page-helpers]) 
  (:use [ring.adapter.jetty :only [run-jetty]])
  (:require [cauca.factory :as f]
+           [cauca.log :as log]
            [compojure.route :as route]
            [compojure.handler :as handler]
            [clojure.data.json :as json]

     (try
       (handler request)
       (catch Exception e
         (-> (resp/response (ui-template (exception->html e)))
           (resp/status 500)
           (resp/content-type "text/html"))
         ))))

 (def app
   (-> #'main-routes
       (wrap-reload '[cauca.component.rest])
       catch-errors))

 (defn start-server! [] (run-jetty app {:port 8080
                                        :join? false}))

 (defn -main [] (start-server!))

     (include-js "/js/script.js")
     ]
    [:body
     [:h1 "CAUCA API"]
     [:ul 
      [:li "/courtauction"
       [:ul
        [:li "법원 경매 정보 리스트 조회"]
        [:li "method:get"]
       ]
       ]
      [:li "/courtauction/:id"
       [:ul
        [:li "법원 경매 정보 조회"]
        [:li "method:get"]
       ]
       ]
      ]
     ]
    ))

 (defn cauca-writer [key value]
  (if (or (= key :auctionDate) (= key :regDate) (= key :updDate))
    (str (java.sql.Date. (.getTime value)))
    value))

 (defroutes main-routes
   (GET "/" [] (main-page))
   (GET "/api/courtauction/:id" [id]
        (let [dao-impl# (f/get-obj :courtauction-dao)
              ret-courtauction (first (.get-courtauction dao-impl# id))
              json (json/write-str ret-courtauction :value-fn cauca-writer :escape-unicode false)]
          (log/log-message json)
          (-> (resp/response json)
            (resp/content-type "application/json; charset=utf-8"))))
   (GET "/api/courtauction" {params :query-params}
        (str "itemType:" (params "itemType") "<br/>"
             "addr0:" (params "addr0") "<br/>"
             "addr1:" (params "addr1") "<br/>"
             "value:" (params "value") "<br/>"
             "valueMin:" (params "valueMin") "<br/>"
             "auctionDate:" (params "auctionDate")))
   (route/not-found "Page not found"))
 
 (def main-handler (-> main-routes handler/api))

 (defn exception->html [e]
   (concat
