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 '{"scope": "global", "group":"test", "value":"test-value"}' "http://localhost:32000/gateway/api/configuration/create" // curl -X GET "http://localhost:32000/gateway/api/configuration/values?scope=global&group=test&pageNo=1&pageSize=1" // curl -X POST -H "Content-Type: application/json" -d '{"scope": "global", "group":"test"}' "http://localhost:32000/gateway/api/configuration/delete" // Class // curl -X POST -H "Content-Type: application/json" -d '{"name":"test", "studentNum": 10}' "http://localhost:32000/gateway/api/v1/class/create" // curl -X PUT -H "Content-Type: application/json" -d '{"id":"a58aec380ac243aea4e9a47bca4964e5", "name":"test-new"}' "http://localhost:32000/gateway/api/v1/class/update" // curl -X GET "http://localhost:32000/gateway/api/v1/class/query?name=test-new&pageNo=1&pageSize=1" // curl -X GET "http://localhost:32000/gateway/api/v1/class/get?id=a58aec380ac243aea4e9a47bca4964e5" // curl -X DELETE "http://localhost:32000/gateway/api/v1/class/delete?id=a58aec380ac243aea4e9a47bca4964e5" // Student // curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' "http://localhost:32000/gateway/api/v1/student/create" // curl -X PUT -H "Content-Type: application/json" -d '{"id":"bdd469c05e244b5b91b17295a8dd221f", "name":"test-new"}' "http://localhost:32000/gateway/api/v1/student/update" // curl -X GET "http://localhost:32000/gateway/api/v1/student/query?name=test-new&pageNo=1&pageSize=1" // curl -X GET "http://localhost:32000/gateway/api/v1/student/get?id=bdd469c05e244b5b91b17295a8dd221f" // curl -X DELETE "http://localhost:32000/gateway/api/v1/student/delete?id=bdd469c05e244b5b91b17295a8dd221f" // Family // curl -X POST -H "Content-Type: application/json" -d '{"father":"father", "mother": "mother"}' "http://localhost:32000/gateway/api/v1/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/family/update" // curl -X GET "http://localhost:32000/gateway/api/v1/family/query?father=new-father&pageNo=0&pageSize=0" // curl -X GET "http://localhost:32000/gateway/api/v1/family/get?id=094cb5b08a244163b0ccf02d45c07025" // curl -X DELETE "http://localhost:32000/gateway/api/v1/family/delete?id=094cb5b08a244163b0ccf02d45c07025" // Identity // curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' "http://localhost:32000/gateway/api/v1/identity/create" // curl -X PUT -H "Content-Type: application/json" -d '{"id":"cc591981a91c412a9e20be5eec683121", "name":"test-new"}' "http://localhost:32000/gateway/api/v1/identity/update" // curl -X GET "http://localhost:32000/gateway/api/v1/identity/query?name=test-new&pageNo=1&pageSize=1" // curl -X GET "http://localhost:32000/gateway/api/v1/identity/get?id=cc591981a91c412a9e20be5eec683121" // curl -X DELETE "http://localhost:32000/gateway/api/v1/identity/delete?id=cc591981a91c412a9e20be5eec683121" // Class-Student // curl -X POST -H "Content-Type: application/json" -d '{"id":"a38786c698904224a6fc36a23c2eec1e", "studentIds": ["00254b4a7102429db35e6edc8e47a764"]}' "http://localhost:31000/example/api/v1/class/student/update" // curl -X GET "http://localhost:31000/example/api/v1/class/student/query?id=a38786c698904224a6fc36a23c2eec1e" // Student-Class // curl -X POST -H "Content-Type: application/json" -d '{"id":"00254b4a7102429db35e6edc8e47a764", "classId": "a38786c698904224a6fc36a23c2eec1e"}' "http://localhost:31000/example/api/v1/student/class/update" // curl -X GET "http://localhost:31000/example/api/v1/student/class/query?id=00254b4a7102429db35e6edc8e47a764" // curl -X GET "http://localhost:31000/example/api/v1/student/class/queryWith?name=test" // Student-Family // curl -X POST -H "Content-Type: application/json" -d '{"id":"33d5538ee04843b59db1560b7ab65427", "familyId": "848d175d04e74e64a90cc9ccb4f4fcaf"}' "http://localhost:31000/example/api/v1/student/family/update" // curl -X GET "http://localhost:31000/example/api/v1/student/family/query?id=33d5538ee04843b59db1560b7ab65427" // curl -X GET "http://localhost:31000/example/api/v1/student/family/queryWith?name=test" // Family-Student // curl -X POST -H "Content-Type: application/json" -d '{"id":"848d175d04e74e64a90cc9ccb4f4fcaf", "studentId": "33d5538ee04843b59db1560b7ab65427"}' "http://localhost:31000/example/api/v1/family/student/update" // curl -X GET "http://localhost:31000/example/api/v1/family/student/query?id=848d175d04e74e64a90cc9ccb4f4fcaf" // curl -X GET "http://localhost:31000/example/api/v1/family/student/queryWith?father=father" // Student-Identity // curl -X POST -H "Content-Type: application/json" -d '{"id":"7880acb4f5df40a2b98055d15858f13d", "identityIds": ["58ab7e64e8ea46b5982aedca0d2fa5d0"]}' "http://localhost:31000/example/api/v1/student/identity/update" // curl -X GET "http://localhost:31000/example/api/v1/student/identity/query?id=7880acb4f5df40a2b98055d15858f13d" // Identity-Student // curl -X POST -H "Content-Type: application/json" -d '{"id":"58ab7e64e8ea46b5982aedca0d2fa5d0", "studentIds": ["7880acb4f5df40a2b98055d15858f13d"]}' "http://localhost:31000/example/api/v1/identity/student/update" // curl -X GET "http://localhost:31000/example/api/v1/identity/student/query?id=58ab7e64e8ea46b5982aedca0d2fa5d0" // Student-Hobby // curl -X POST -H "Content-Type: application/json" -d '{"id":"7880acb4f5df40a2b98055d15858f13d", "hobbyIds": ["42b305bb292c4082a3e91a2967f11111"]}' "http://localhost:31000/example/api/v1/student/hobby/update" // curl -X GET "http://localhost:31000/example/api/v1/student/hobby/query?id=7880acb4f5df40a2b98055d15858f13d" // Hobby-Student // curl -X POST -H "Content-Type: application/json" -d '{"id":"42b305bb292c4082a3e91a2967f11111", "studentIds": ["7880acb4f5df40a2b98055d15858f13d"]}' "http://localhost:31000/example/api/v1/hobby/student/update" // curl -X GET "http://localhost:31000/example/api/v1/hobby/student/query?id=42b305bb292c4082a3e91a2967f11111" 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() }