我启动了Clojure aleph http服务器,使用以下代码:
(ns app.websvc
(: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))))
(http/start-server http-handler {:port 8080})
我对此进行了测试:
$ curl -v "http://localhost:8080/"
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.58.0
> Accept: */*
>
似乎已连接,但无任何反应。可能是什么问题?
我在本地计算机上运行了相同的代码,curl
命令正确响应,但在新购买的远程云主机上无法正常工作(上述问题)。
我这样做了:
$ telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0
也挂起。