hey guys, quick question: is the not found
advice at the end still valid? I am using compojure-api
2.0.0-alpha7
and that didnt work for me. I got it to work using an ANY
handler with /*
😕
unfortunately by doing that I get a validation schema
error from swagger
=> attribute paths.'/*'. is unexpected"
@carocad hi. can’t recall what was the not found
advice… but I think this is still valid: https://github.com/weavejester/compojure#usage
@ikitommi thanks for the answer. What I am trying to do is to create a 404
handler for any request that doesnt match any handler.
unfortunately the not-found
function is not called if I use it inside the compojure.api.sweet/api
function. Is this a bug?
I havent tried it with a raw compojure
server though. I had to do it that way because the server throws a NullPointerException
otherwise
Hmm.. sound fishy. let me test.
thanks 🙂
here is our handler creation, if it helps https://github.com/hiposfer/kamal/blob/master/src/hiposfer/kamal/server.clj#L24
created a project from template and added (route/not-found "<h1>Page not found</h1>")
into the end. works ok here.
compojure-api warns about non-documented route thou, wrapping that with undocumented
removes the warning.
also, you could do that outside of an api: (let [app (some-fn (create grid) (route/not-found “<h1>Page not found</h1>“))] ...)
ah I found the error. There is a not-found
function from compojure
and there is another not-found
function from compojure-api
. I was mixing the two so it was not recognized
thanks @ikitommi your comments helped me figure out the confusion
np. And yes, there is the ring.util.http-response/not-found
which easily get’s exported in..