    (route/not-found {:status 404 :body {:error "not found"}})
    ))
 
-(defn json-body [handler]
-  (fn [request]
-    (handler (update request :body (comp utils/read-json slurp)))))
-
 (defonce server (atom nil))
 
 (defn stop! [] (if-let [server @server] (.stop server)))

(ns block-chain.http
  (:require [compojure.core :refer :all]
            [ring.adapter.jetty :as jetty]
            [block-chain.utils :as utils]
            [compojure.api.sweet :as sweet]
            [ring.util.http-response :refer :all]
            [ring.util.response :refer [response]]
            [ring.middleware.json :refer [wrap-json-response]]
            [ring.middleware.keyword-params :refer [wrap-keyword-params]]
            [block-chain.message-handlers :as h]
            [schema.core :as s]
            [block-chain.schemas :refer :all]
            [compojure.route :as route]))



(def test-api
  (sweet/api

               :return {:pong s/Int}
               :body-params [ping :- s/Int]
               :summary "Ping with a timestamp and receive a Pong with a corresponding timestamp"
               (ok {:pong ping}))

   (sweet/POST "/balance" req
               :return {:message String :payload {:address s/Str :balance s/Int}}
               :body-params [address :- s/Str]
               :summary "Get balance for a given ClarkeCoin address (DER-encoded RSA public key)."
               (ok (h/handler {:message "get_balance" :payload address} {})))

   (sweet/POST "/blocks" req
               :return {:message String :payload Block}
