This file contains hidden or 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
| (require '[compojure.core :refer [GET]] | |
| '[ring.adapter.jetty :refer [run-jetty]]) | |
| (run-jetty | |
| (GET "/" request (str "Hello World! This is your uri: " (:uri | |
| request))) | |
| {:port 8080 | |
| :join? false}) |
This file contains hidden or 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
| (require '[compojure.core :refer [defroutes GET]] | |
| '[ring.adapter.jetty :refer [run-jetty]]) | |
| (defroutes app | |
| (GET "/" request (str "Hello World! This is your URI: " (:uri request))) | |
| (GET "/:name" [name] (str "Hello, " name))) | |
| (run-jetty app {:port 8080}) |
This file contains hidden or 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
| (require '[compojure.route :as route] | |
| '[compojure.core :refer [defroutes GET POST PUT DELETE ANY]] | |
| '[ring.adapter.jetty :refer [run-jetty]] | |
| '[ring.middleware.keyword-params :as rmkp] | |
| '[ring.middleware.params :as rmp]) | |
| (defroutes app-routes | |
| (POST "/submit" request (handler-that-needs-params request)) | |
| (GET "/submit" request handler-that-needs-params) | |
| (route/not-found (str "404!"))) |
This file contains hidden or 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
| (require '[ring.middleware.params :as rmp] | |
| '[ring.middleware.keyword-params :as rmkp]) | |
| (defn handler-that-needs-keyword-params | |
| [{params :params}] | |
| (ring.util.response/response "Hello" (:name params) " your ID is: " (:id params))) | |
| (rmp/wrap-params | |
| (rmkp/wrap-keyword-params handler-that-needs-keyword-params)) | |
| ;; => new handler function with the combined functionality of |
OlderNewer