main.go 403 B

123456789101112131415161718192021222324252627
  1. package main
  2. import (
  3. "baize-playground/gateway/api"
  4. DEATH "github.com/vrecan/death"
  5. "syscall"
  6. )
  7. func main() {
  8. api.NewGateway()
  9. defer api.DestroyGateway()
  10. go func() {
  11. if err := api.Start(); err != nil {
  12. panic(err)
  13. }
  14. }()
  15. defer func() {
  16. if err := api.Finish(); err != nil {
  17. panic(err)
  18. }
  19. }()
  20. death := DEATH.NewDeath(syscall.SIGINT, syscall.SIGTERM)
  21. _ = death.WaitForDeath()
  22. }