Fork me on GitHub
#reitit
<
2018-09-14
>
ikitommi07:09:00

@aaron51 reitit takes route-first approach, where the middleware (defined in router) are only applied if a route is matched. In your example there is only GET /math defined - if that doesn’t match, the wrap-file is not run. Options here are: 1) use the middleware for the default routes, e.g. (wrap-file (ring/create-default-handler) ".") 2) add a wildcard route ["/* (wrap-file (constantly nil) ".")] where the handler always misses

ikitommi07:09:29

1 is much better, as the wrap-file is only run if none of the actual routes match.

ikitommi07:09:50

I think that wrap-file always first checks if there is a file available. This mean doing slow IO for ALL calls.

aaron5116:09:28

@ikitommi thank you, that helps a lot. I was having a similar issue with ring-cors and this totally explains it