首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用boot运行http-kit?

如何使用boot运行http-kit?
EN

Stack Overflow用户
提问于 2016-10-16 02:22:27
回答 1查看 265关注 0票数 0

在使用boot运行时,我无法从http-kit服务器获得任何响应。它适用于jetty。当我运行boot run时,它会在一段时间后退出。所以我添加了(boot (wait)),它不会终止,但服务器似乎没有运行。

代码语言:javascript
复制
; core.clj
(ns server.core
    (:use [compojure.route :only [files not-found]]
          [compojure.handler :only [site]]
          [compojure.core :only [defroutes GET POST DELETE ANY context]]
          org.httpkit.server))

(defn hello [] 
    "Hello from httpkit")

(defroutes api-routes
    (GET "/" [] (hello)))

(defn -main []
    (run-server api-routes {:port 8080}))

boot.clj文件:

代码语言:javascript
复制
;boot.clj
(set-env!
    :source-paths #{"src"}
    :dependencies '[[org.clojure/clojure "1.8.0"]
                    [ring "1.5.0"]
                    [compojure "1.5.1"]
                    [http-kit "2.2.0"]])

(require '[server.core :as server])

(deftask run []
    (with-pre-wrap fileset (server/-main) fileset)
    (boot (wait)))
EN

回答 1

Stack Overflow用户

发布于 2016-10-17 13:37:15

您可以使用boot-http和类似以下内容:

代码语言:javascript
复制
 (boot (serve :handler 'server/-main :reload true) (wait))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40062648

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档