瀏覽代碼

[FEAT] add example

Adrien Carteron 2 年之前
父節點
當前提交
4ed6142526
共有 2 個文件被更改,包括 17 次插入17 次删除
  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