Skip to content

Instantly share code, notes, and snippets.

@oitee
Created October 12, 2022 04:36
Show Gist options
  • Save oitee/f8a738af34bf3b379f5bc7aa514f7e7d to your computer and use it in GitHub Desktop.
Save oitee/f8a738af34bf3b379f5bc7aa514f7e7d to your computer and use it in GitHub Desktop.
(defn handler-that-supports-multiple-routes
[{:keys [uri request-method] :as request}]
request
(cond
(and (= uri "/contact")
(= request-method :get))
{:status 200
:headers {}
:body "Contact us at [email protected]"}
(and (= uri "/home")
(= request-method :get))
{:status 200
:headers {}
:body "Hello World!"}
:else
{:status 404
:headers {}
:body "Not found!"}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment