mirror of
https://github.com/metosin/reitit.git
synced 2026-02-08 21:03:11 +00:00
Update docs
This commit is contained in:
parent
5edb3efe4e
commit
35e5b1d9b4
1 changed files with 15 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ There are two options to serve the files.
|
||||||
|
|
||||||
## Internal routes
|
## Internal routes
|
||||||
|
|
||||||
This is good option if static files can be from non-conflicting paths, e.g. `/assets/*`.
|
This is good option if static files can be from non-conflicting paths, e.g. `"/assets/*"`.
|
||||||
|
|
||||||
|
|
||||||
```clj
|
```clj
|
||||||
|
|
@ -19,9 +19,22 @@ This is good option if static files can be from non-conflicting paths, e.g. `/as
|
||||||
(ring/create-default-handler))
|
(ring/create-default-handler))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To serve static files with conflicting routes, e.g. `"/*#`, one needs to disable the confligt resolution:
|
||||||
|
|
||||||
|
```clj
|
||||||
|
(require '[reitit.ring :as ring])
|
||||||
|
|
||||||
|
(ring/ring-handler
|
||||||
|
(ring/router
|
||||||
|
[["/ping" (constantly {:status 200, :body "pong"})]
|
||||||
|
["/*" (ring/create-resource-handler)]]
|
||||||
|
{:conflicts (constantly nil)})
|
||||||
|
(ring/create-default-handler))
|
||||||
|
```
|
||||||
|
|
||||||
## External routes
|
## External routes
|
||||||
|
|
||||||
To serve files from conflicting paths, e.g. `/*`, one option is to mount them to default-handler branch of `ring-handler`. This way, they are only served if none of the actual routes have matched.
|
To serve files from conflicting paths, e.g. `"/*"`, one option is to mount them to default-handler branch of `ring-handler`. This way, they are only served if none of the actual routes have matched.
|
||||||
|
|
||||||
|
|
||||||
```clj
|
```clj
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue