Fork me on GitHub
#pedestal
<
2022-04-13
>
jtth00:04:37

Can anyone give advice on how to redirect a static route to a resource (“index.html”)? I’m not sure where to slurp the file from when running in prod from an uberjar (which packages the contents of the resources folder)

jtth00:04:49

Solved my own problem:

(defn home-page
  [request]
  (-> (ring-resp/response
        (str (slurp ( "public/index.html"))))
      (ring-resp/content-type "text/html")))
Though if anyone knows about something simpler to just do the redirect that’d be neat.

emccue12:04:49

(defn home-page
  [request]
  (response/redirect "public/index.html"))
If you serve the resource in addition on that path

jtth00:04:49

Solved my own problem:

(defn home-page
  [request]
  (-> (ring-resp/response
        (str (slurp ( "public/index.html"))))
      (ring-resp/content-type "text/html")))
Though if anyone knows about something simpler to just do the redirect that’d be neat.