untangled

NEW CHANNEL: #fulcro
jwkoelewijn 2017-03-24T11:17:45.992575Z

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

jwkoelewijn 2017-03-24T11:19:21.010695Z

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.kay 2017-03-24T15:27:20.129448Z

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

tony.kay 2017-03-24T15:27:40.137718Z

See the modular-server branch of the template

tony.kay 2017-03-24T15:27:56.143925Z

@jwkoelewijn ^^^

tony.kay 2017-03-24T15:29:19.176094Z

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.kay 2017-03-24T15:29:43.185471Z

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

2017-03-24T17:54:12.279067Z

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.

👍 3
adambros 2017-03-24T22:56:17.051757Z

@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

jwkoelewijn 2017-03-24T23:37:04.369627Z

@adambros @tony.kay thanks for the info!

jwkoelewijn 2017-03-24T23:38:51.381480Z

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 :))

jwkoelewijn 2017-03-24T23:39:57.388863Z

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.kay 2017-03-24T23:40:44.394280Z

sure, that works too