File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 44 [icw.data.process-faster]
55 [icw.web.core :as web]))
66
7+ ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8+ ; ; Introduction
9+ ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
710
811; ; Start HTTP server
912
1013(comment
1114 (system/start! ))
1215
13-
16+ ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1417; ; Chapter 1 - Lazy sequences
18+ ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1519
1620; ; http://localhost:6789/albums
1721
1822; ; Where is it located ? Let's jump there
1923web/app
2024
25+ ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2126; ; Chapter 2 - Concurrency
27+ ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2228
2329; ; Can we make make populate-db faster?
2430
Original file line number Diff line number Diff line change 1- ; ; [[file:~/github/intermediate-clojure-workshop/content/web/core.org::*The%20Preamble][The Preamble:1]]
21(ns icw.web.core
32 (:require [compojure.core :as c]
43 [aleph.http :as http]
54 [ring.middleware
65 [keyword-params :refer [wrap-keyword-params]]
76 [params :refer [wrap-params]]
87 [json :refer [wrap-json-response]]]
8+ [icw.web.handlers.albums :as albums]
99 [icw.search.core :as search]))
1010
1111(defn wrap-body [response-body]
1212 {:status 200
1313 :body response-body})
14- ; ; The Preamble:1 ends here
1514
16- ; ; [[file:~/github/intermediate-clojure-workshop/content/web/core.org::*The%20Albums%20Context][The Albums Context:1]]
1715(def albums-context
1816 (c/context " /albums" [:as request]
1917 (c/GET " /" []
2018 (wrap-body
21- { :message " Here be your JSON-ful of albums" } ))
19+ ( albums/list- albums) ))
2220 (c/GET " /:id" [id]
2321 (wrap-body {:message (str " Here be your JSON of an album with id " id)}))))
24- ; ; The Albums Context:1 ends here
2522
26- ; ; [[file:~/github/intermediate-clojure-workshop/content/web/core.org::*The%20Search%20Context][The Search Context:1]]
2723(def search-context
2824 (c/context " /search" [:as request]
2925 (c/GET " /:term" [term]
3228 (or
3329 (search/search (keyword field) term)
3430 (wrap-body {:message (str " Looking for " term " in field " field " , eh?" )}))))))
35- ; ; The Search Context:1 ends here
3631
37- ; ; [[file:~/github/intermediate-clojure-workshop/content/web/core.org::*Tying%20Together][Tying Together:1]]
3832(c/defroutes app*
39- albums-context
40- search-context )
33+ albums-context
34+ search-context )
4135
4236(def app
4337 (c/routes
You can’t perform that action at this time.
0 commit comments