local.go 683 B

123456789101112131415161718192021222324252627282930313233343536
  1. package http
  2. import (
  3. "net/http"
  4. "go-common/app/service/main/resource/conf"
  5. "go-common/library/log"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. // ping check server ok.
  9. func ping(c *bm.Context) {
  10. if err := resSvc.Ping(c); err != nil {
  11. log.Error("resource service ping error(%v)", err)
  12. c.AbortWithStatus(http.StatusServiceUnavailable)
  13. }
  14. }
  15. // version check server version.
  16. func version(c *bm.Context) {
  17. data := map[string]interface{}{
  18. "version": conf.Conf.Version,
  19. }
  20. c.JSONMap(data, nil)
  21. }
  22. // register for discovery
  23. func register(c *bm.Context) {
  24. c.JSON(nil, nil)
  25. }
  26. // monitor for monitorURL
  27. func monitor(c *bm.Context) {
  28. resSvc.Monitor(c)
  29. c.JSON(nil, nil)
  30. }