Comments (7)
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.
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.
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.
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.
That's great! Thanks, Tommi, and thanks for this library!
from reitit.
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.
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)
- Reitit Examples has a bug with Swagger HOT 4
- Batteries-included `api-middleware`
- Muuntaja – OpenAPI integration HOT 1
- Generate swagger top-level definitions for spec & schema
- Malli -> Openapi fails with custom registries HOT 1
- Consider supporting defmulti as handler
- Example projects using reitit.swagger fail to compile
- The server is starting fine but the Swagger UI in the frontend is flashing an error HOT 1
- How about supporting uppercased route HTTP in Ring handler method keywords? HOT 2
- Is it possible to do multi host with reitit-routes? HOT 2
- New version of `@seriousme/openapi-schema-validator` finds new errors HOT 1
- `reitit.coercion.malli` - invalid keys for :responses are accepted
- [Bug] Can't generate swagger with var references HOT 2
- Improve reitit malli humanize data so you can map the errors back to the submitted data.
- Drop Java 8 support
- Resource handler: serve index file without a redirect
- Route data maps ignore meta-merge options in 0.7.0, breaking compatibility HOT 3
- reitit.pedestal/replace-last-interceptor does not replace pedestal router
- Route data validation using malli HOT 1
- Body parameters are always an array HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reitit.