Git Product home page Git Product logo

Comments (7)

anghene avatar anghene commented on August 21, 2024 2

Ok, this is a long time ago, I remember I found a solution to this. See this repo of mine. Hope it helps.

from reitit.

ikitommi avatar ikitommi commented on August 21, 2024 1

I think it's ok for the Router to have a contract of always returning nil case of error (ring-router is just a normal Router with :compile and :coerce options pre-configured to support http-stuff). The not-found could be handled in the ring-app level, something like:

(def app
  (ring/ring-handler
    (ring/router
      ["/api"
       ["/query/:name" hello-n]
       ["/goodbye"     goodbye]
       ["/hello"       hello]])
    {:not-found not-found-handler}))

Another option would be just to write a guide how to do that in the client-code:

(def app
  (some-fn
    (ring/ring-handler
      (ring/router
        ["/api"
         ["/query/:name" hello-n]
         ["/goodbye" goodbye]
         ["/hello" hello]]))
    not-found-handler))

Need to drink the morning coffee before having an opinion on this.

What do you think?

from reitit.

ikitommi avatar ikitommi commented on August 21, 2024 1

I added a chapter about the 404 into the ring-docs. Let's start with this and see how things evolve. If the ring-handler has others reasons to have options, this could be put in then.

and thanks, there is btw a great perf improvement about to be released: #44

from reitit.

chrisdavies avatar chrisdavies commented on August 21, 2024

I'm down with either solution. I like the second one, as it's still simple, and doesn't add to the library.

Also, unrelated, but I keep reading the name "reitit as re-tit". Just thought someone should know!

Thanks for the library, though. Really great work!

from reitit.

chrisdavies avatar chrisdavies commented on August 21, 2024

That's great! Thanks, Tommi, and thanks for this library!

from reitit.

anghene avatar anghene commented on August 21, 2024

Thanks for the library Tommi, it's awesome.
I'm also trying to deal with a not-found in the reitit.frontend library where I wrap my clojurescript app and serve views depending on reitit.core.Match object. What's the standard on this if I want to serve a not-found path and still retain path and template data ?

from reitit.

theaspirational avatar theaspirational commented on August 21, 2024

Thanks for the library Tommi, it's awesome. I'm also trying to deal with a not-found in the reitit.frontend library where I wrap my clojurescript app and serve views depending on reitit.core.Match object. What's the standard on this if I want to serve a not-found path and still retain path and template data ?

I'm trying to do that too. have you found a way out?

from reitit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.