Fork me on GitHub
#pedestal
<
2023-10-04
>
agorgl09:10:28

Hello! I'm using fast-resource interceptor to serve static resources (in order to have the index? functionality). While developing this seems to work (as it serves resources from the filesystem) but when used from within an uberjar, I get a clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException in Interceptor :io.pedestal.http.ring-middlewares/fast-resource - Not a file: jar:file:/path/to/app.jar!/public/ Is this intended? If so shouldn't the interceptor be named fast-file instead of fast-resource?

souenzzo20:10:59

Here seems that ::http/type can be only a keyword https://github.com/pedestal/pedestal/blob/master/service/src/io/pedestal/http.clj#L312 Here seems that ::http/type can be a keyword or a function https://github.com/pedestal/pedestal/blob/master/service/src/io/pedestal/http.clj#L343 It seems wired to me.

hlship02:10:23

Yes, I'm working on that, and introducing schemas to properly describe and validate what all the options are.

👍 1
hlship02:10:49

Should be keyword or function, and I'm updating docs to lean towards function, not keyword. Better for AOT compilation and such.

souenzzo09:10:44

if ::http/type is a function, it requires ::http/chain-provider ::http/chain-provider is a function service-map -> service-map that should assoc a new keys, usually ::http/service-fn etc into service-map ::http/type is a function service-map options -> srv-description, where options contains keys like :port, and srv-description should contins at least :server :start-fn :stop-fn I'm working in a new HTTP backend for pedestal 🙂 Mostly for learning//fun

souenzzo09:10:01

btw, service-map->server-options//server-map->service-map functions makes the code way harder to browse, once you can't use find keyword usages

hlship18:10:26

I don't want to disparage the prior code owners, I'm sure there were some reasons for all of this.

👍 1
souenzzo21:10:19

btw, less then 100LOC and about 5 functions to create a new pedestal backend, from http://java.net.ServerSocket. for sure a wrong and incomplete server (still not writing headers, etc). but a nice experience