Skip to content

Instantly share code, notes, and snippets.

@oitee
Created October 12, 2022 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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 hello@email.com"}
(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