diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -10,6 +10,7 @@ applications. Include `abra` by adding the following to your dependencies: + :::clojure [org.clojars.czan/abra "0.1.0"] At the very bottom of your middleware stack (closest to your actual @@ -22,6 +23,7 @@ Instead of `compojure.core/`{`defroutes`,`routes`,`context`}, use As an example: + :::clojure (require '[abra.core :refer [routes context] :as abra]) (def app (-> (routes (context "/api" [] (-> #'api-routes @@ -33,6 +35,7 @@ As an example: When giving a route a name, wrap it in a call to `abra.core/register-route`: + :::clojure (defroutes site-routes (register-route :username (GET "/username/" [] @@ -43,6 +46,7 @@ methods: `GET`, `POST`, `PUT`, `DELETE`, `HEAD` and `ANY`. To later retrieve this url, use the `abra.core/url-for` function: + :::clojure (defroutes api-routes (GET "/" [] (str "url: " (url-for :username)))) @@ -53,6 +57,7 @@ used for the url, although this information may be exposed in future. A route may also require parameters, in which case the `url-for` function must be provided the correct number of additional parameters: + :::clojure (defroutes test-routes (context "/user/:id" [id] (register-route :user-attr |