Skip to content

Commit d944ad5

Browse files
committed
Update README.md
fix example code.
1 parent 61b418f commit d944ad5

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Stuff on top of [Compojure](https://github.com/weavejester/compojure) for making
1414

1515
[![Clojars Project](http://clojars.org/metosin/compojure-api/latest-version.svg)](http://clojars.org/metosin/compojure-api)
1616

17-
**NOTE** All codes in `master` are already against the upcoming `1.0.0`. Wiki is for the latest stabile version.
17+
**NOTE** All codes in `master` are already against the upcoming `1.0.0`. Wiki is partially still for `0.24.5`.
1818

1919
## For information and help
2020

@@ -47,25 +47,32 @@ Stuff on top of [Compojure](https://github.com/weavejester/compojure) for making
4747

4848
(s/defschema Pizza
4949
{:name s/Str
50+
(s/optional-key :description) s/Str
5051
:size (s/enum :L :M :S)
5152
:origin {:country (s/enum :FI :PO)
5253
:city s/Str}})
5354

5455
(defapi app
55-
{:swagger {:spec "/swagger.json"
56-
:ui "/api-docs"
57-
:data {:data {:info {:title "My Swagger API"
58-
:description "Compojure Api example"}
59-
:tags [{:name "api", :description "sample api"}]}})
56+
{:swagger
57+
{:ui "/api-docs"
58+
:spec "/swagger.json"
59+
:data {:info {:title "Sample API"
60+
:description "Compojure Api example"}
61+
:tags [{:name "api", :description "some apis"}]}}}
62+
6063
(context "/api" []
6164
:tags ["api"]
62-
(GET "/hello" []
63-
:query-params [name :- String]
64-
(ok {:message (str "Hello, " name)}))
65-
(POST "/pizza" []
65+
66+
(GET "/plus" []
67+
:return {:result Long}
68+
:query-params [x :- Long, y :- Long]
69+
:summary "adds two numbers together"
70+
(ok {:result (+ x y)}))
71+
72+
(POST "/echo" []
6673
:return Pizza
6774
:body [pizza Pizza]
68-
:summary "echoes a pizza"
75+
:summary "echoes a Pizza"
6976
(ok pizza))))
7077
```
7178

0 commit comments

Comments
 (0)