main.go 368 B

123456789101112131415161718192021222324
  1. package main
  2. import (
  3. "dhcp/initialize"
  4. "os"
  5. "os/signal"
  6. "syscall"
  7. )
  8. func main() {
  9. // 初始化日志
  10. initialize.InitLogger("info")
  11. //初始化http服务
  12. r := initialize.InitRouter()
  13. if err := r.Run("0.0.0.0:9999"); err != nil {
  14. panic(err)
  15. }
  16. //优雅退出
  17. quit := make(chan os.Signal)
  18. signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
  19. <-quit
  20. }