From 35e5b1d9b445ec0b99fe12929951047120db04dc Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Mon, 23 Apr 2018 08:33:44 +0300 Subject: [PATCH] Update docs --- doc/ring/static.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/ring/static.md b/doc/ring/static.md index edc23ce5..9ff3bbbc 100644 --- a/doc/ring/static.md +++ b/doc/ring/static.md @@ -6,7 +6,7 @@ There are two options to serve the files. ## 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 @@ -19,9 +19,22 @@ This is good option if static files can be from non-conflicting paths, e.g. `/as (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 -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