| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package main
- import (
- "git.sxidc.com/go-framework/baize/examples/examples/project/application"
- DEATH "github.com/vrecan/death"
- "syscall"
- )
- // Version
- // curl -X GET "http://localhost:31000/example/version"
- // Configuration
- // curl -X POST -H "Content-Type: application/json" -d '{"scope": "global", "group":"test", "value":"test-value"}' "http://localhost:31000/example/configuration/create"
- // curl -X GET "http://localhost:31000/example/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:31000/example/configuration/delete"
- // Class
- // curl -X POST -H "Content-Type: application/json" -d '{"name":"test", "studentNum": 10}' "http://localhost:31000/example/v1/class/create"
- // curl -X PUT -H "Content-Type: application/json" -d '{"id":"ed3f9cffdcfe4984ac72425b447b7ce6", "name":"test-new"}' "http://localhost:31000/example/v1/class/update"
- // curl -X GET "http://localhost:31000/example/v1/class/query?name=test-new&pageNo=1&pageSize=1"
- // curl -X GET "http://localhost:31000/example/v1/class/get?id=ed3f9cffdcfe4984ac72425b447b7ce6"
- // curl -X DELETE "http://localhost:31000/example/v1/class/ed3f9cffdcfe4984ac72425b447b7ce6/delete"
- // Student
- // curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' "http://localhost:31000/example/v1/student/create"
- // curl -X PUT -H "Content-Type: application/json" -d '{"id":"6e12ee71397746b8920fa94e5f229366", "name":"test-new"}' "http://localhost:31000/example/v1/student/update"
- // curl -X GET "http://localhost:31000/example/v1/student/query?name=test-new&pageNo=1&pageSize=1"
- // curl -X GET "http://localhost:31000/example/v1/student/get?id=6e12ee71397746b8920fa94e5f229366"
- // curl -X DELETE "http://localhost:31000/example/v1/student/6e12ee71397746b8920fa94e5f229366/delete"
- // Family
- // curl -X POST -H "Content-Type: application/json" -d '{"father":"father", "mother": "mother"}' "http://localhost:31000/example/v1/family/create"
- // curl -X PUT -H "Content-Type: application/json" -d '{"id":"8a3af91da12c4a3eb040ffb535693f1a", "father":"new-father", "mother": "new-mother"}' "http://localhost:31000/example/v1/family/update"
- // curl -X GET "http://localhost:31000/example/v1/family/query?father=new-father&pageNo=0&pageSize=0"
- // curl -X GET "http://localhost:31000/example/v1/family/get?id=8a3af91da12c4a3eb040ffb535693f1a"
- // curl -X DELETE "http://localhost:31000/example/v1/family/8a3af91da12c4a3eb040ffb535693f1a/delete"
- // Student-Family
- // curl -X POST -H "Content-Type: application/json" -d '{"id":"fc3e96926aac46268ae783c4ad675d43", "familyId": "ed86bbb59a80429eb654d7f9f13ff116"}' "http://localhost:31000/example/v1/student/family/update"
- // curl -X GET "http://localhost:31000/example/v1/student/family/query?id=fc3e96926aac46268ae783c4ad675d43"
- // curl -X GET "http://localhost:31000/example/v1/student/family/queryWith?id=fc3e96926aac46268ae783c4ad675d43"
- // Family-Student
- // curl -X POST -H "Content-Type: application/json" -d '{"id":"ed86bbb59a80429eb654d7f9f13ff116", "studentId": "fc3e96926aac46268ae783c4ad675d43"}' "http://localhost:31000/example/v1/family/student/update"
- // curl -X GET "http://localhost:31000/example/v1/family/student/query?id=ed86bbb59a80429eb654d7f9f13ff116"
- // curl -X GET "http://localhost:31000/example/v1/family/student/queryWith?id=ed86bbb59a80429eb654d7f9f13ff116"
- func main() {
- application.NewApp()
- defer application.DestroyApp()
- go func() {
- err := application.Start()
- if err != nil {
- panic(err)
- }
- }()
- defer func() {
- err := application.Finish()
- if err != nil {
- panic(err)
- }
- }()
- death := DEATH.NewDeath(syscall.SIGINT, syscall.SIGTERM)
- _ = death.WaitForDeath()
- }
|