-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Router serving static-file only works locally #254
Comments
You should just be able to serve the PDF as a resource from the public folder. |
(defroutes routes
(GET "/" [] (redirect
(let [config (resolve-config)]
(path (:blog-prefix config)
(when (= (:clean-urls config) :dirty)
"index.html")))))
(GET "/cv1" [] (ring.util.response/file-response
(path
"public/pdf/cv-2022-11-03.pdf")))
(GET "/cv2" [] (ring.util.response/file-response
(path
"pdf/cv-2022-11-03.pdf")))
(GET "/cv3" [] (ring.util.response/file-response
(path "cv-2022-11-03.pdf"))) $ tree public/pdf/
public/pdf/
├── cv-2021-08-11.pdf
└── cv-2022-11-03.pdf
0 directories, 2 files This doesn't work. None of the three end-points. I don't know what to try further. |
Oh, yeah, if I run But, not on the deployed website. |
The problem there is that you won't have a server running once you build the site. You'd have to link to the PDF file from the page relative to your public folder. |
I see. Could you give me an example, or a direction, of how I may achieve that? I have no idea. Thanks in advance. |
I want to create a router for <website.com>/cv1 and serve a pdf.
Locally, it works just fine. That is,
curl
will work. And, the page renders a pdf on the browser.Locally:
But, in my website, it gives 404, www.buddhilw.com/cv1.
In the
server.clj
, I defined the routercv1
, as so:What could I do to accomplish the file-serving?
What I have tried
(path "<path>.pdf") and dropping the
(let [config (resolve-config)] ...)` stuffNone worked.
The text was updated successfully, but these errors were encountered: