hewei 5 年之前
父節點
當前提交
efc5cea702
共有 2 個文件被更改,包括 38 次插入10 次删除
  1. 4 6
      README.md
  2. 34 4
      html/downloads/scripts/getting_started.sh

+ 4 - 6
README.md

@@ -75,16 +75,14 @@ bin/curl -v localhost:8080/downloads/
 # http api service
 bin/curl -v localhost:8080/v1/api/hello
 bin/curl -v localhost:8080/v1/api/echo -d "hello,world!"
-bin/curl -v localhost:8080/v1/api/query?page_no=1&page_size=10
+bin/curl -v localhost:8080/v1/api/query?page_no=1\&page_size=10
 bin/curl -v localhost:8080/v1/api/kv   -H "Content-Type:application/x-www-form-urlencoded" -d 'user=admin&pswd=123456'
 bin/curl -v localhost:8080/v1/api/json -H "Content-Type:application/json" -d '{"user":"admin","pswd":"123456"}'
 bin/curl -v localhost:8080/v1/api/form -F "file=@LICENSE"
 
-bin/curl -v localhost:8080/v1/api/test  -H "Content-Type:application/x-www-form-urlencoded" -d
-'bool=1&int=123&float=3.14&string=hello'
-bin/curl -v localhost:8080/v1/api/test  -H "Content-Type:application/json" -d
-'{"bool":true,"int":123,"float":3.14,"string":"hello"}'
-bin/curl -v localhost:8080/v1/api/test  -F 'bool=1 int=123 float=3.14 string=hello'
+bin/curl -v localhost:8080/v1/api/test -H "Content-Type:application/x-www-form-urlencoded" -d 'bool=1&int=123&float=3.14&string=hello'
+bin/curl -v localhost:8080/v1/api/test -H "Content-Type:application/json" -d '{"bool":true,"int":123,"float":3.14,"string":"hello"}'
+bin/curl -v localhost:8080/v1/api/test -F 'bool=1 int=123 float=3.14 string=hello'
 # RESTful API: /group/:group_name/user/:user_id
 bin/curl -v -X DELETE localhost:8080/v1/api/group/test/user/123
 

+ 34 - 4
html/downloads/scripts/getting_started.sh

@@ -1,22 +1,52 @@
 #!/bin/bash
 
-make httpd curl
+if [ ! -x bin/httpd -o ! -x bin/curl ]; then
+    make httpd curl
+fi
 
-bin/httpd -s restart -d
+processes=$(ps aux | grep -v grep | grep httpd | wc -l)
+if [ $processes -lt 1 ]; then
+    bin/httpd -s restart -d
+fi
 ps aux | grep httpd
 
+PS4="\033[32m+ \033[0m"
+set -x
+
 # http web service
+read -n1
 bin/curl -v localhost:8080
 
 # http indexof service
+read -n1
 bin/curl -v localhost:8080/downloads/
 
 # http api service
-bin/curl -v localhost:8080/v1/api/hello
+read -n1
 bin/curl -v localhost:8080/v1/api/echo -d "hello,world!"
-bin/curl -v localhost:8080/v1/api/query?page_no=1&page_size=10
+
+read -n1
+bin/curl -v localhost:8080/v1/api/query?page_no=1\&page_size=10
+
+read -n1
 bin/curl -v localhost:8080/v1/api/kv   -H "Content-Type:application/x-www-form-urlencoded" -d 'user=admin&pswd=123456'
+
+read -n1
 bin/curl -v localhost:8080/v1/api/json -H "Content-Type:application/json" -d '{"user":"admin","pswd":"123456"}'
+
+read -n1
 bin/curl -v localhost:8080/v1/api/form -F "file=@LICENSE"
+
+read -n1
+bin/curl -v localhost:8080/v1/api/test -H "Content-Type:application/x-www-form-urlencoded" -d 'bool=1&int=123&float=3.14&string=hello'
+
+read -n1
+bin/curl -v localhost:8080/v1/api/test -H "Content-Type:application/json" -d '{"bool":true,"int":123,"float":3.14,"string":"hello"}'
+
+read -n1
+bin/curl -v localhost:8080/v1/api/test -F 'bool=1 int=123 float=3.14 string=hello'
+
 # RESTful API: /group/:group_name/user/:user_id
+read -n1
 bin/curl -v -X DELETE localhost:8080/v1/api/group/test/user/123
+