NielsK
NielsK

Reputation: 6956

Using lein ring server, how to switch to another adapter than ring-jetty-adapter

Given a simple webapplication like

(ns webtest.handler
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

(defroutes app-routes
           (GET "/" [] "Hello World")
           (route/not-found "Not Found"))

(def app
  (-> (wrap-defaults app-routes site-defaults)))

that can be started using lein ring server, how would one be able to adapt the project to switch out the jetty adapter for another ring adapter, for instance undertow or http-kit?

For reference, here's the excerpt of the lein project.clj in use:

  :dependencies [[org.clojure/clojure "1.9.0"]
                 [ring "1.8.1" :exclusions [ring/ring-jetty-adapter]]
                 [luminus/ring-undertow-adapter "1.1.0"]
                 [ring/ring-defaults "0.3.2"]
                 [compojure "1.6.1"]]
  :plugins [[lein-ring "0.12.5"]]
  :ring {:handler webtest.handler/app}

Upvotes: 1

Views: 204

Answers (1)

Michael SALIHI
Michael SALIHI

Reputation: 126

You can use :adapter key.

Finally I tested and no, the tag :adapter allows to pass the options for ring.jetty.adapter only. After analyse the source code, there is no possibility to switch the adapter.

Here an reponse from the plugin author to a similar query: https://stackoverflow.com/a/24307363/5773724

Upvotes: 1

Related Questions