diff --git a/advanced/composing_routers.html b/advanced/composing_routers.html index c9a6b425..f8c878bb 100644 --- a/advanced/composing_routers.html +++ b/advanced/composing_routers.html @@ -1124,7 +1124,7 @@ diff --git a/advanced/configuring_routers.html b/advanced/configuring_routers.html index 1ed77fc9..c1eca57d 100644 --- a/advanced/configuring_routers.html +++ b/advanced/configuring_routers.html @@ -830,7 +830,7 @@ diff --git a/advanced/dev_workflow.html b/advanced/dev_workflow.html index b18ed373..bad1a78b 100644 --- a/advanced/dev_workflow.html +++ b/advanced/dev_workflow.html @@ -889,7 +889,7 @@ diff --git a/advanced/different_routers.html b/advanced/different_routers.html index 88ae9817..29ea45a8 100644 --- a/advanced/different_routers.html +++ b/advanced/different_routers.html @@ -833,7 +833,7 @@ diff --git a/advanced/route_validation.html b/advanced/route_validation.html index eec6b72a..9f548cee 100644 --- a/advanced/route_validation.html +++ b/advanced/route_validation.html @@ -925,7 +925,7 @@ diff --git a/advanced/shared_routes.html b/advanced/shared_routes.html index 998582f0..04aa530f 100644 --- a/advanced/shared_routes.html +++ b/advanced/shared_routes.html @@ -845,7 +845,7 @@ diff --git a/basics/name_based_routing.html b/basics/name_based_routing.html index 83844524..1589a214 100644 --- a/basics/name_based_routing.html +++ b/basics/name_based_routing.html @@ -848,7 +848,7 @@ diff --git a/basics/path_based_routing.html b/basics/path_based_routing.html index c6ea95c1..9151f8be 100644 --- a/basics/path_based_routing.html +++ b/basics/path_based_routing.html @@ -806,7 +806,7 @@ diff --git a/basics/route_conflicts.html b/basics/route_conflicts.html index 09b4d5be..f3fdb432 100644 --- a/basics/route_conflicts.html +++ b/basics/route_conflicts.html @@ -849,7 +849,7 @@ diff --git a/basics/route_data.html b/basics/route_data.html index 1a26372f..a9e8c648 100644 --- a/basics/route_data.html +++ b/basics/route_data.html @@ -847,7 +847,7 @@ diff --git a/basics/route_data_validation.html b/basics/route_data_validation.html index d10d64f0..efb0e0cf 100644 --- a/basics/route_data_validation.html +++ b/basics/route_data_validation.html @@ -899,7 +899,7 @@ diff --git a/basics/route_syntax.html b/basics/route_syntax.html index be2ea9bb..5c37a23e 100644 --- a/basics/route_syntax.html +++ b/basics/route_syntax.html @@ -836,7 +836,7 @@ E.g., /foo bar should be /foo%20bar.

diff --git a/basics/router.html b/basics/router.html index a45c22d8..a09597ba 100644 --- a/basics/router.html +++ b/basics/router.html @@ -816,7 +816,7 @@ diff --git a/coercion/clojure_spec_coercion.html b/coercion/clojure_spec_coercion.html index 81eab366..8bd38c92 100644 --- a/coercion/clojure_spec_coercion.html +++ b/coercion/clojure_spec_coercion.html @@ -823,7 +823,7 @@ diff --git a/coercion/coercion.html b/coercion/coercion.html index eaef0fca..954bc9b9 100644 --- a/coercion/coercion.html +++ b/coercion/coercion.html @@ -913,7 +913,7 @@ diff --git a/coercion/data_spec_coercion.html b/coercion/data_spec_coercion.html index f3d61659..557af315 100644 --- a/coercion/data_spec_coercion.html +++ b/coercion/data_spec_coercion.html @@ -812,7 +812,7 @@ diff --git a/coercion/schema_coercion.html b/coercion/schema_coercion.html index 07acce95..6dbbd783 100644 --- a/coercion/schema_coercion.html +++ b/coercion/schema_coercion.html @@ -813,7 +813,7 @@ diff --git a/development.html b/development.html index cdaa4861..eb4a0684 100644 --- a/development.html +++ b/development.html @@ -803,7 +803,7 @@ lein test diff --git a/faq.html b/faq.html index 41371ecb..6539c29f 100644 --- a/faq.html +++ b/faq.html @@ -881,7 +881,7 @@ diff --git a/frontend/basics.html b/frontend/basics.html index 954a3df0..837b1435 100644 --- a/frontend/basics.html +++ b/frontend/basics.html @@ -791,7 +791,7 @@ React breaking due to errors). diff --git a/frontend/browser.html b/frontend/browser.html index 8d153dfc..53e817f9 100644 --- a/frontend/browser.html +++ b/frontend/browser.html @@ -795,7 +795,7 @@ router instance and passes the instance to all calls.

diff --git a/frontend/controllers.html b/frontend/controllers.html index f76efb23..d02d5f7e 100644 --- a/frontend/controllers.html +++ b/frontend/controllers.html @@ -879,7 +879,7 @@ missing resources.

diff --git a/http/default_interceptors.html b/http/default_interceptors.html index 6b45d9f4..d2649eda 100644 --- a/http/default_interceptors.html +++ b/http/default_interceptors.html @@ -803,7 +803,7 @@ diff --git a/http/interceptors.html b/http/interceptors.html index 87af3186..7481061b 100644 --- a/http/interceptors.html +++ b/http/interceptors.html @@ -795,7 +795,7 @@ diff --git a/http/pedestal.html b/http/pedestal.html index 44343b73..b3911a3e 100644 --- a/http/pedestal.html +++ b/http/pedestal.html @@ -803,7 +803,7 @@ diff --git a/http/sieppari.html b/http/sieppari.html index 573acaa5..ceac2159 100644 --- a/http/sieppari.html +++ b/http/sieppari.html @@ -843,7 +843,7 @@ diff --git a/index.html b/index.html index 1c499ce1..971c5d48 100644 --- a/index.html +++ b/index.html @@ -923,7 +923,7 @@ diff --git a/performance.html b/performance.html index ba5ce082..45263680 100644 --- a/performance.html +++ b/performance.html @@ -860,7 +860,7 @@ diff --git a/ring/coercion.html b/ring/coercion.html index c24a2c4b..30cb06ea 100644 --- a/ring/coercion.html +++ b/ring/coercion.html @@ -914,7 +914,7 @@ diff --git a/ring/compiling_middleware.html b/ring/compiling_middleware.html index 7944dad1..efa9321e 100644 --- a/ring/compiling_middleware.html +++ b/ring/compiling_middleware.html @@ -841,7 +841,7 @@ diff --git a/ring/data_driven_middleware.html b/ring/data_driven_middleware.html index de8cd1c5..6c564524 100644 --- a/ring/data_driven_middleware.html +++ b/ring/data_driven_middleware.html @@ -869,7 +869,7 @@ diff --git a/ring/default_handler.html b/ring/default_handler.html index b71c6d40..94863394 100644 --- a/ring/default_handler.html +++ b/ring/default_handler.html @@ -847,7 +847,7 @@ diff --git a/ring/default_middleware.html b/ring/default_middleware.html index 9109c538..46fdc437 100644 --- a/ring/default_middleware.html +++ b/ring/default_middleware.html @@ -1013,7 +1013,7 @@ Server: Jetty(9.2.21.v20170120) diff --git a/ring/dynamic_extensions.html b/ring/dynamic_extensions.html index 5afd3f32..d9b01630 100644 --- a/ring/dynamic_extensions.html +++ b/ring/dynamic_extensions.html @@ -816,7 +816,7 @@ diff --git a/ring/middleware_registry.html b/ring/middleware_registry.html index 1e020e2e..e415dab4 100644 --- a/ring/middleware_registry.html +++ b/ring/middleware_registry.html @@ -827,7 +827,7 @@ diff --git a/ring/reverse_routing.html b/ring/reverse_routing.html index 11488e20..b76d8fe1 100644 --- a/ring/reverse_routing.html +++ b/ring/reverse_routing.html @@ -812,7 +812,7 @@ diff --git a/ring/ring.html b/ring/ring.html index fa5aa0e5..44bbeff9 100644 --- a/ring/ring.html +++ b/ring/ring.html @@ -948,7 +948,7 @@ diff --git a/ring/route_data_validation.html b/ring/route_data_validation.html index 2d6f4672..6ce12f98 100644 --- a/ring/route_data_validation.html +++ b/ring/route_data_validation.html @@ -1024,7 +1024,7 @@ diff --git a/ring/slash_handler.html b/ring/slash_handler.html index 496358ec..ca151f86 100644 --- a/ring/slash_handler.html +++ b/ring/slash_handler.html @@ -850,7 +850,7 @@ diff --git a/ring/static.html b/ring/static.html index 46a664bb..53e187aa 100644 --- a/ring/static.html +++ b/ring/static.html @@ -852,7 +852,7 @@ diff --git a/ring/swagger.html b/ring/swagger.html index 7371d058..877bc273 100644 --- a/ring/swagger.html +++ b/ring/swagger.html @@ -841,7 +841,7 @@ @@ -855,10 +855,9 @@ see the next example [["/api" ["/ping" {:get (constantly {:status 200, :body "ping"})}] ["/pong" {:post (constantly {:status 200, :body "pong"})}]] - ["/swagger.json" - {:get {:no-doc true - :handler (swagger/create-swagger-handler)}}]]) - (swagger-ui/create-swagger-ui-handler {:path "/"}))) + ["" {:no-doc true} + ["/swagger.json" {:get (swagger/create-swagger-handler)}] + ["/api-docs/*" {:get (swagger-ui/create-swagger-ui-handler)}]]])))

The generated swagger spec:

(app {:request-method :get :uri "/swagger.json"})
@@ -869,9 +868,22 @@ see the next example
 ;                "/api/pong" {:post {}}}}}
 

Swagger-ui:

-
(app {:request-method :get :uri "/"})
+
(app {:request-method :get, :uri "/api-docs/index.html"})
 ; ... the swagger-ui index-page, configured correctly
 
+

You might be interested in adding a trailing slash handler to the app to serve the swagger-ui from /api-docs (without the trailing slash) too.

+

Another way to serve the swagger-ui is using the default handler:

+
(def app
+  (ring/ring-handler
+    (ring/router
+      [["/api"
+        ["/ping" {:get (constantly {:status 200, :body "ping"})}]
+        ["/pong" {:post (constantly {:status 200, :body "pong"})}]]
+       ["/swagger.json"
+        {:get {:no-doc true
+               :handler (swagger/create-swagger-handler)}}]]) 
+    (swagger-ui/create-swagger-ui-handler {:path "/api-docs"})))
+

More complete example