Fork me on GitHub
#reitit
<
2020-10-07
>
chadhs17:10:49

https://github.com/metosin/reitit/blob/master/doc/ring/static.md is there a way to do this (ring/create-resource-handler {:path "/"}) to serve up your frontend but not have the index.html show in the browser?

juhoteperi18:10:53

Just add route for /, I think: ["/" (ring/create-resource-handler)]

juhoteperi18:10:31

Or no. That will still create the redirect response.

juhoteperi18:10:00

I guess I've always written the index handler myself, instead of using the Reitit helpers.

chadhs18:10:23

@U061V0GG2 my goal is just to have the ability to serve up the frontend from the backend

juhoteperi18:10:03

["/" (constantly (ring.util.response/resource-response "public/index.html"))]

chadhs18:10:18

that makes sense. that’s actually the same way i’ve done it in the past with ring+compojure; was too hung up on the reitit helpers i suppose

chadhs18:10:21

(defn handle-index [req]
  ;; NOTE: this will deliver your index.html
  (-> (response/resource-response "index.html" {:root "public"})
      (response/content-type "text/html")))