Fork me on GitHub
#untangled
<
2017-03-24
>
jwkoelewijn11:03:45

Hi, is there any way to change the default not-found handler in untangled-server? I do not seem to be able to add my own not-found handler to my custom-routes

jwkoelewijn11:03:21

is there a way to set the not-found handler? at the moment the bidi-routes seem to hard-wire the not-found handler in untangled.server.impl.components.handler

tony.kay15:03:20

If you use the modular server support, you can completely define your Ring stack

tony.kay15:03:40

See the modular-server branch of the template

tony.kay15:03:19

you could also plug into the hooks of the regular server...there is a fallback-hook described in http://untangled-web.github.io/untangled/guide.html#!/untangled_devguide.M40_Advanced_Server_Topics

tony.kay15:03:43

it comes just before the not-found, so you could put your logic there and never let if fall through further

nha17:03:12

Re: untangled css PR. Thanks for the input, I will try to have a look this weekend (only time I can have a look actually). Note: I use it with “plain" Om, so I am not familiar at all with untangled right now.

adambrosio22:03:17

@jwkoelewijn take a look at https://github.com/untangled-web/untangled-server/tree/develop#23-defining-your-own-middleware, there’s a line that defines a function that returns {:status 404} if it ever gets called

jwkoelewijn23:03:51

I actually found a solution in Bidi by defining my routes as nested vectors instead of a map I was able to define a not-found handler that was only called whanever no other route matched (compared to adding the [true :not-found] route in the map syntax, that would always match as a result of the not being ordered properties of the map :))

jwkoelewijn23:03:57

I’ll take a look at your suggestions to see if I can use your suggestions to improve on my current solution, so lot of interesting stuff to look forward to

tony.kay23:03:44

sure, that works too