Fix reader conditional example

The previous example only worked by accident (because there was an even number of map keys with conditional values).

{:get #?(:clj 1), :post #?(:clj 2)} gets read as {:get :post} in a non-clj context. The splicing reader conditional or a :cljs (or :default) value is needed to have the code work as intended. Here we change the docs to use the splicing version, as that is (imho) more beautiful than adding another branch.
This commit is contained in:
Hannu Hartikainen 2018-10-05 13:27:56 +03:00 committed by GitHub
parent 31d2bc5832
commit 9e05d58880
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,8 +17,8 @@ There are multiple options to use shared routing table.
(def routes (def routes
["/kikka" ["/kikka"
{:name ::kikka {:name ::kikka
:get #?(:clj {:handler get-kikka}) #?@(:clj [:get {:handler get-kikka}])
:post #?(:clj {:handler post-kikka})}]) #?@(:clj [:post {:handler post-kikka}])}])
``` ```
## Using custom expander ## Using custom expander