main.go 436 B

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