This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-18
Channels
- # announcements (2)
- # architecture (10)
- # beginners (51)
- # cider (14)
- # cljsrn (1)
- # clojure (13)
- # clojure-uk (3)
- # clojurescript (63)
- # cursive (1)
- # datomic (8)
- # emacs (1)
- # figwheel (1)
- # figwheel-main (18)
- # fulcro (62)
- # hyperfiddle (1)
- # incanter (1)
- # jobs-discuss (4)
- # off-topic (3)
- # parinfer (6)
- # reagent (5)
- # ring-swagger (3)
- # shadow-cljs (25)
- # sql (2)
- # tools-deps (2)
My handler looks like this, and when I navigate to /api-docs
the swagger page loads but it can’t find swagger.json
(500 error) . What’s the obvious mistake I’m making?
(ns sullivan.server.handler
(:require
[compojure.api.sweet :refer :all]
[compojure.route :refer [resources files]]
[ring.util.response :refer [redirect]]
[ring.util.http-response :refer :all]
[compojure.api.upload :as upload]
[ :as io]))
(def app
(routes
;; Static resources
(resources "/cljs-out" {:root "public/cljs-out"})
(resources "/css" {:root "public/css"})
(resources "/" {:root "public"})
;; API
(api
(swagger-routes {:ui "/api-docs"})
(context "/api" []
(GET "/getter" []
:query-params [n]
(-> (ok n) (content-type "text/plain")))
(POST "/upload_file" []
:multipart-params [file :- upload/TempFileUpload]
:middleware [upload/wrap-multipart-params]
(let [res (ok (dissoc file :tempfile))]
res))))
;; index.html for SPA (handle 404 clientside)
(GET "*" []
(-> (ok (slurp (io/resource "index.html")))
(content-type "text/html")))))