This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-21
Channels
- # announcements (51)
- # asami (5)
- # babashka (25)
- # babashka-sci-dev (26)
- # beginners (33)
- # calva (10)
- # clj-kondo (51)
- # clj-yaml (99)
- # clojure (96)
- # clojure-australia (3)
- # clojure-berlin (5)
- # clojure-europe (151)
- # clojure-norway (58)
- # clojurescript (20)
- # cursive (13)
- # datalevin (1)
- # datomic (19)
- # docker (6)
- # emacs (55)
- # events (1)
- # fulcro (50)
- # gratitude (8)
- # juxt (7)
- # leiningen (5)
- # malli (6)
- # membrane (1)
- # nbb (28)
- # off-topic (22)
- # pathom (7)
- # polylith (20)
- # portal (1)
- # reagent (37)
- # reitit (2)
- # releases (2)
- # reveal (32)
- # scittle (34)
- # shadow-cljs (46)
- # testing (10)
- # tools-deps (33)
- # xtdb (18)
How to make Swagger routes using reitit and pedestal? I have the following:
(ns service
(:require
[io.pedestal.http :as http]
[reitit.swagger :as swagger]
[reitit.swagger-ui :as swagger-ui]))
(def swagger-handler
(swagger/create-swagger-handler))
(def swagger-ui-handler
(swagger-ui/create-swagger-ui-handler))
(def ping-handler
(fn [_req] {:status 200, :body "pong"}))
(def routes
`[[["/api"
["/ping" {:get ping-handler}]]
^{:no-doc true}
["/"
["/swagger.json" {:get swagger-handler}]
["/api-docs/*" {:get swagger-ui-handler}]]]])
(def service
{:env :prod
::http/routes routes
::http/allowed-origins [""]
::http/resource-path "/public"
::http/type :jetty
::http/port 3000
::http/host "0.0.0.0"
::http/container-options {:h2c? true
:h2? false
:ssl? false}})
(defonce runnable-service (server/create-server service))
(defn -main
"The entry-point for 'lein run'"
[& _args]
(println "\nCreating your server...")
(server/start runnable-service))
but this returns:
internal server exception .. Caused by: java.lang.IllegalArgumentException: No implementation of method: :compiled-routes of protocol: #'reitit.core/Router found for class: nil
The /ping route without the swagger routes does work.