pedestal

Philipp Siegmantel 2020-06-14T08:44:35.215300Z

Hello, I'm new to pedestal and am trying to figure out how to serve static resources. My routes look like this

(def routes #{["/static/" :get [(fast-resource "/static")]]})
but trying to curl a file results in a 404.

Philipp Siegmantel 2020-06-14T08:45:24.216Z

The curl command looks like this:

curl <http://localhost:8080/static/header.png>
But other variations didn't work either.

Joe Lane 2020-06-14T17:56:30.216700Z

@philipp.siegmantel Check this pedestal sample out https://github.com/pedestal/pedestal/tree/master/samples/ring-middleware

Joe Lane 2020-06-14T17:57:12.217300Z

It serves a static http form.

hindol 2020-06-14T18:25:00.217400Z

Did you put your resources under resources/static/?

Philipp Siegmantel 2020-06-14T18:38:58.221400Z

@lanejo01 Thank you, but I don't think that the example covers what I am trying to do. I didn't specify it in detail, so let's just do it know. I simply want to serve xml, audio and video files. fast-resource seems to be exactly what I want, but I can't seem to get it to work.

Philipp Siegmantel 2020-06-14T18:47:00.222700Z

I just checked and it's in the right place.

hindol 2020-06-14T18:48:53.222900Z

::http/resource-path "/public"

hindol 2020-06-14T18:49:00.223100Z

This is worth trying.

hindol 2020-06-14T18:49:11.223300Z

http://pedestal.io/cookbook/index

hindol 2020-06-14T18:50:12.223500Z

This will not use fast-resource but will use resource middleware. The former uses Java NIO.

Philipp Siegmantel 2020-06-14T18:54:13.223700Z

thanks, I'll try that

Philipp Siegmantel 2020-06-14T18:56:05.223900Z

It works, thanks for your help