aleph

cmal 2018-10-26T10:07:47.000900Z

Hi, I have a problem when using aleph as a http server: https://stackoverflow.com/questions/53004800/clojure-aleph-http-server-does-not-respond-body Can anyone here help me with this? Thanks!

lispyclouds 2018-10-26T10:17:33.001500Z

@cmal Seems to work for me.

curl -v "<http://localhost:8080/>"
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
&gt; GET / HTTP/1.1
&gt; Host: localhost:8080
&gt; User-Agent: curl/7.61.1
&gt; Accept: */*
&gt;
&lt; HTTP/1.1 200 OK
&lt; Content-Type: text/plain
&lt; Server: Aleph/0.4.4
&lt; Connection: Keep-Alive
&lt; Date: Fri, 26 Oct 2018 10:16:02 GMT
&lt; content-length: 14
&lt;
* Connection #0 to host localhost left intact
wallet backend

lispyclouds 2018-10-26T10:17:49.001900Z

how have you configured the main?

lispyclouds 2018-10-26T10:18:41.002500Z

i wrote this and it works

(ns myapp.core
  (:require
   [aleph.http :as http]
   [compojure.core :as compojure :refer [GET POST]]
   [ring.middleware.params :as params]))

(defn root-handler
  [req]
  {:status 200
   :headers {"content-type" "text/plain"}
   :body "wallet backend"})

(def http-handler
  (params/wrap-params
   (compojure/routes
    (GET "/" [] root-handler))))

(defn -main
  []
  (http/start-server http-handler {:port 8080}))