123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- package main
- import (
- "baize-demo/project/gateway/api"
- DEATH "github.com/vrecan/death"
- "syscall"
- )
- // Version
- // curl -X GET "http://localhost:32000/gateway/api/version"
- // Configuration
- // curl -X POST -H "Content-Type: application/json" -d '{"serviceShortName": "example", "scope": "global", "group":"test", "value":"test-value"}' "http://localhost:32000/gateway/api/configuration/create"
- // curl -X GET "http://localhost:32000/gateway/api/configuration/values?serviceShortName=example&scope=global&group=test&pageNo=1&pageSize=1"
- // curl -X POST -H "Content-Type: application/json" -d '{"serviceShortName": "example", "scope": "global", "group":"test"}' "http://localhost:32000/gateway/api/configuration/delete"
- // curl -X GET "http://localhost:32000/gateway/api/configuration/registered/services"
- // Class
- // curl -X POST -H "Content-Type: application/json" -d '{"name":"test", "studentNum": 10}' "http://localhost:32000/gateway/api/v1/example/class/create"
- // curl -X PUT -H "Content-Type: application/json" -d '{"id":"1a6103829c7142d49a81106815b11319", "name":"test-new"}' "http://localhost:32000/gateway/api/v1/example/class/update"
- // curl -X GET "http://localhost:32000/gateway/api/v1/example/class/query?name=test-new&pageNo=1&pageSize=1"
- // curl -X GET "http://localhost:32000/gateway/api/v1/example/class/get?id=1a6103829c7142d49a81106815b11319"
- // curl -X DELETE "http://localhost:32000/gateway/api/v1/example/class/delete?id=1a6103829c7142d49a81106815b11319"
- // Student
- // curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' "http://localhost:32000/gateway/api/v1/example/student/create"
- // curl -X PUT -H "Content-Type: application/json" -d '{"id":"bdd469c05e244b5b91b17295a8dd221f", "name":"test-new"}' "http://localhost:32000/gateway/api/v1/example/student/update"
- // curl -X GET "http://localhost:32000/gateway/api/v1/example/student/query?name=test-new&pageNo=1&pageSize=1"
- // curl -X GET "http://localhost:32000/gateway/api/v1/example/student/get?id=bdd469c05e244b5b91b17295a8dd221f"
- // curl -X DELETE "http://localhost:32000/gateway/api/v1/example/student/delete?id=bdd469c05e244b5b91b17295a8dd221f"
- // Family
- // curl -X POST -H "Content-Type: application/json" -d '{"father":"father", "mother": "mother"}' "http://localhost:32000/gateway/api/v1/example/family/create"
- // curl -X PUT -H "Content-Type: application/json" -d '{"id":"094cb5b08a244163b0ccf02d45c07025", "father":"new-father", "mother": "new-mother"}' "http://localhost:32000/gateway/api/v1/example/family/update"
- // curl -X GET "http://localhost:32000/gateway/api/v1/example/family/query?father=new-father&pageNo=0&pageSize=0"
- // curl -X GET "http://localhost:32000/gateway/api/v1/example/family/get?id=094cb5b08a244163b0ccf02d45c07025"
- // curl -X DELETE "http://localhost:32000/gateway/api/v1/example/family/delete?id=094cb5b08a244163b0ccf02d45c07025"
- // Identity
- // curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' "http://localhost:32000/gateway/api/v1/example/identity/create"
- // curl -X PUT -H "Content-Type: application/json" -d '{"id":"cc591981a91c412a9e20be5eec683121", "name":"test-new"}' "http://localhost:32000/gateway/api/v1/example/identity/update"
- // curl -X GET "http://localhost:32000/gateway/api/v1/example/identity/query?name=test-new&pageNo=1&pageSize=1"
- // curl -X GET "http://localhost:32000/gateway/api/v1/example/identity/get?id=cc591981a91c412a9e20be5eec683121"
- // curl -X DELETE "http://localhost:32000/gateway/api/v1/example/identity/delete?id=cc591981a91c412a9e20be5eec683121"
- // Class-Student
- // curl -X POST -H "Content-Type: application/json" -d '{"id":"11d1ecf2795244af89d0b13c606f2396", "studentIds": ["4340e46e439e410fa3b0569e15354da6"]}' "http://localhost:31000/example/api/v1/example/class/student/update"
- // curl -X GET "http://localhost:31000/example/api/v1/example/class/student/query?id=11d1ecf2795244af89d0b13c606f2396"
- // Student-Class
- // curl -X POST -H "Content-Type: application/json" -d '{"id":"4340e46e439e410fa3b0569e15354da6", "classId": "11d1ecf2795244af89d0b13c606f2396"}' "http://localhost:31000/example/api/v1/example/student/class/update"
- // curl -X GET "http://localhost:31000/example/api/v1/example/student/class/query?id=4340e46e439e410fa3b0569e15354da6"
- // curl -X GET "http://localhost:31000/example/api/v1/example/student/class/queryWith?name=test"
- // Student-Family
- // curl -X POST -H "Content-Type: application/json" -d '{"id":"4340e46e439e410fa3b0569e15354da6", "familyId": "6d15704c1cac42788aa9866cc5d09649"}' "http://localhost:31000/example/api/v1/example/student/family/update"
- // curl -X GET "http://localhost:31000/example/api/v1/example/student/family/query?id=4340e46e439e410fa3b0569e15354da6"
- // curl -X GET "http://localhost:31000/example/api/v1/example/student/family/queryWith?name=test"
- // Family-Student
- // curl -X POST -H "Content-Type: application/json" -d '{"id":"6d15704c1cac42788aa9866cc5d09649", "studentId": "4340e46e439e410fa3b0569e15354da6"}' "http://localhost:31000/example/api/v1/example/family/student/update"
- // curl -X GET "http://localhost:31000/example/api/v1/example/family/student/query?id=6d15704c1cac42788aa9866cc5d09649"
- // curl -X GET "http://localhost:31000/example/api/v1/example/family/student/queryWith?father=father"
- // Student-Identity
- // curl -X POST -H "Content-Type: application/json" -d '{"id":"4340e46e439e410fa3b0569e15354da6", "identityIds": ["1988069accce47f58679d7a46ce605c3"]}' "http://localhost:31000/example/api/v1/example/student/identity/update"
- // curl -X GET "http://localhost:31000/example/api/v1/example/student/identity/query?id=4340e46e439e410fa3b0569e15354da6"
- // Identity-Student
- // curl -X POST -H "Content-Type: application/json" -d '{"id":"1988069accce47f58679d7a46ce605c3", "studentIds": ["4340e46e439e410fa3b0569e15354da6"]}' "http://localhost:31000/example/api/v1/example/identity/student/update"
- // curl -X GET "http://localhost:31000/example/api/v1/example/identity/student/query?id=1988069accce47f58679d7a46ce605c3"
- // Student-Hobby
- // curl -X POST -H "Content-Type: application/json" -d '{"id":"4340e46e439e410fa3b0569e15354da6", "hobbyIds": ["42b305bb292c4082a3e91a2967f11111"]}' "http://localhost:31000/example/api/v1/example/student/hobby/update"
- // curl -X GET "http://localhost:31000/example/api/v1/example/student/hobby/query?id=4340e46e439e410fa3b0569e15354da6"
- // Hobby-Student
- // curl -X POST -H "Content-Type: application/json" -d '{"id":"42b305bb292c4082a3e91a2967f11111", "studentIds": ["4340e46e439e410fa3b0569e15354da6"]}' "http://localhost:31000/example/api/v1/example/hobby/student/update"
- // curl -X GET "http://localhost:31000/example/api/v1/example/hobby/student/query?id=42b305bb292c4082a3e91a2967f11111"
- // Sql Executor
- // curl -X POST -H 'Content-Type: application/json' -d '{"serviceShortName": "example", "sql": "SELECT * FROM test.sql_execute_logs", "executorId": "guest-00254b4a7102429db35e6edc8e"}' "http://localhost:32000/gateway/api/sql/execute"
- // curl -X GET "http://localhost:32000/gateway/api/sql/execute/log?serviceShortName=example&sql=SELECT&executorId=guest-00254b4a7102429db35e6edc8e&executorName=gue"
- // curl -X GET "http://localhost:32000/gateway/api/sql/execute/registered/services"
- func main() {
- api.NewGateway()
- defer api.DestroyGateway()
- go func() {
- if err := api.Start(); err != nil {
- panic(err)
- }
- }()
- defer func() {
- if err := api.Finish(); err != nil {
- panic(err)
- }
- }()
- death := DEATH.NewDeath(syscall.SIGINT, syscall.SIGTERM)
- _ = death.WaitForDeath()
- }
|