Fork me on GitHub
#pedestal
<
2018-08-29
>
lxsameer07:08:16

hey folks, i’m using pedestal router only. how can I use middleware/fast-resource with it. do I need to add a new route for resources ?

ddeaguiar21:08:09

No but the fast-resource interceptor needs to come before the router interceptor

ddeaguiar21:08:38

otherwise the router interceptor will try and match the request and return a 404

ddeaguiar21:08:53

Just to add more context, the presence of :io.pedestal.http/resource-path in the service map leads to the resource interceptor to be conj’d onto the interceptor coll when io.pedestal.default-interceptors is invoked and :io.pedestal.http/interceptors is not present.

ddeaguiar21:08:18

The value of :io.pedestal.http/resource-path is used to create the resource interceptor as follows: (middlewares/resource resource-path)

ddeaguiar21:08:10

so you can essentially do the same thing but using io.pedestal.http.ring-middlewares/fast-resource

ddeaguiar21:08:48

Your container needs to support async NIO responses

hlship21:08:02

We've noticed that a route that's a handler function, where the handler returns nil, results in a 404 response. That's just what we want BUT are curious if that is intentional behavior.