 (defn json-response [callback data & [status]]
   {:status (or status 200) ;; Status code: 200 'OK (The request was fulfilled)'
    :headers {"Content-Type" "application/jsonp; charset=UTF-8"}
-   :body
-   (do
-     (println "callback" callback "data" data)
-     (let [json-data (json/write-str data)]
-       (if callback
-         (str callback "(" json-data ")") ;; encapsulate the return in jsonp
-         json-data)))})
+   :body (let [json-data (json/write-str data)]
+           (if callback
+             (str callback "(" json-data ")") ;; encapsulate the return in jsonp
+             json-data))})
 
 (def fmap
   {:users    {:db db/users    :prm {}}

                 (println "ERROR" fnkw "does not exist in the fmap"))
        dbfnprm (into edn-body (get-in fmap [fnkw :prm]))]
    (let [{sql :sql rows :rows} (dbfn dbfnprm)]
      (let [joe (json-response callback ["joj-foj" ["foj" "joj"] [] []])]
        (println "joe" joe)
        (let [res (json-response callback [{:sql sql :rows rows}])]
          (println "res" res)
          res)))))
#_
(defroutes myapp
  (GET "/"     [] "Show something")

  (GET "/"    req (file-response "public/html/index.html" {:root "resources"}))
  (PUT "/req" req (doreq req))
  (GET "/users/ids=:ids" req
    (let [query-string (:query-string req)
          callback (subs query-string (count "callback="))
          edn-body (conj {:f :users, :log true, :nocache true, :rowlim 1}
                         {:ids (->> req :params :ids read-string)})]
      (doreq-json callback {:edn-body edn-body})))

  (GET "/jsonreq/:search" req
    (let [query-string (:query-string req)
          callback (subs query-string (count "callback="))]
      (json-response callback ["joe-foo-stuff" ["foo" "joe"] [] []])))

  (route/files "/" {:root "resources/public"})
  (route/not-found "<h1>Page not foundX</h1>"))

