Last active
August 29, 2015 14:14
-
-
Save ddeaguiar/d8a6485d5dd81f5bf527 to your computer and use it in GitHub Desktop.
bidi routing sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns routing.core | |
(:require [bidi.bidi :as b] | |
[bidi.ring :as r] | |
[ring.mock.request :refer [request] :rename {request mock-request}])) | |
(defn index-handler | |
[req] | |
{:status 200 :body "Index"}) | |
(def handler-map | |
{:index index-handler}) | |
(def routing-table | |
["/" {"index" :index | |
["articles/" :id "/article"] :article}]) | |
(def handler | |
(r/make-handler routing-table handler-map)) | |
(handler (mock-request :get "/index")) | |
;; {:status 200 :body "Index"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment