Przeglądaj źródła

[FEAT] add example

Adrien Carteron 2 lat temu
rodzic
commit
4ed6142526
2 zmienionych plików z 17 dodań i 17 usunięć
  1. 17 0
      README.md
  2. 0 17
      test.sh

+ 17 - 0
README.md

@@ -55,4 +55,21 @@ set the score of a player
 ### DELETE /players
 remove all players
 
+### Examples
+```
+curl -X POST -d '{"name":"Player 1","score":0}' -H "Content-Type: application/json" http://127.0.0.1:8080/players
+
+curl -X POST -d '{"name":"Player 2","score":0}' -H "Content-Type: application/json" http://127.0.0.1:8080/players
+
+curl -X POST -d '{"name":"Player 3","score":0}' -H "Content-Type: application/json" http://127.0.0.1:8080/players
+
+curl -X POST -d '{"name":"Player 4","score":0}' -H "Content-Type: application/json" http://127.0.0.1:8080/players
+
+curl -X PATCH -d '{"score":42}' -H "Content-Type: application/json" "http://127.0.0.1:8080/players/Player%201"
+
+curl -X GET "http://127.0.0.1:8080/players/Player%201"
+
+curl -X GET "http://127.0.0.1:8080/players/Player%202"
 
+curl -X DELETE -H "Content-Type: application/json" http://127.0.0.1:8080/players
+```

+ 0 - 17
test.sh

@@ -1,17 +0,0 @@
-#!/bin/bash
-
-curl -X POST -d '{"name":"Player 1","score":0}' -H "Content-Type: application/json" http://127.0.0.1:8080/players
-
-curl -X POST -d '{"name":"Player 2","score":0}' -H "Content-Type: application/json" http://127.0.0.1:8080/players
-
-curl -X POST -d '{"name":"Player 3","score":0}' -H "Content-Type: application/json" http://127.0.0.1:8080/players
-
-curl -X POST -d '{"name":"Player 4","score":0}' -H "Content-Type: application/json" http://127.0.0.1:8080/players
-
-curl -X PATCH -d '{"score":42}' -H "Content-Type: application/json" "http://127.0.0.1:8080/players/Player%201"
-
-curl -X GET "http://127.0.0.1:8080/players/Player%201"
-
-curl -X GET "http://127.0.0.1:8080/players/Player%202"
-
-curl -X DELETE -H "Content-Type: application/json" http://127.0.0.1:8080/players