Skip to content

Commit f804824

Browse files
committed
URL shortener: clean up main
1 parent 99db18e commit f804824

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

url-shortener/dev/user.clj

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,25 @@
1414
(when @*server
1515
(main/stop-server @*server)
1616
(reset! *server nil)))
17+
18+
(comment
19+
(start-server)
20+
(stop-server))
21+
22+
23+
(comment ; test web api
24+
(require '[clojure.java.shell :refer [sh]])
25+
26+
(sh "curl" "-X" "POST"
27+
"-H" "Content-Type: application/json"
28+
"http://localhost:8000/"
29+
"-d" "{\"url\": \"https://clojurescript.org/\"}")
30+
31+
(sh "curl" "-X" "PUT"
32+
"-H" "Content-Type: application/json"
33+
"http://localhost:8000/clj"
34+
"-d" "{\"url\": \"https://clojure.org/\"}")
35+
36+
(sh "curl" "-i" "http://localhost:8000/clj")
37+
38+
(sh "curl" "http://localhost:8000/list/"))

url-shortener/src/url_shortener/main.clj

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,3 @@
2121
(.addShutdownHook
2222
(Runtime/getRuntime)
2323
(Thread. ^Runnable #(stop-server server)))))
24-
25-
(comment
26-
(def server (start-server {:port 8000 :join? false}))
27-
(stop-server server)
28-
29-
(require '[clojure.java.shell :refer [sh]])
30-
31-
(sh "curl" "-X" "POST"
32-
"-H" "Content-Type: application/json"
33-
"http://localhost:8000/"
34-
"-d" "{\"url\": \"https://clojurescript.org/\"}")
35-
36-
(sh "curl" "-X" "PUT"
37-
"-H" "Content-Type: application/json"
38-
"http://localhost:8000/clj"
39-
"-d" "{\"url\": \"https://clojure.org/\"}")
40-
41-
(sh "curl" "-i" "http://localhost:8000/clj")
42-
43-
(sh "curl" "http://localhost:8000/list/")
44-
)
45-
46-

0 commit comments

Comments
 (0)