Fork me on GitHub
#aleph
<
2018-10-26
>
cmal10:10:47

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!

lispyclouds10:10:33

@cmal Seems to work for me.

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

lispyclouds10:10:49

how have you configured the main?

lispyclouds10:10:41

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}))