http.go 627 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package http
  2. import (
  3. "go-common/app/job/main/block/conf"
  4. "go-common/app/job/main/block/service"
  5. "go-common/library/log"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. var (
  9. svc *service.Service
  10. )
  11. // Init init
  12. func Init() {
  13. initService()
  14. engine := bm.DefaultServer(conf.Conf.BM)
  15. router(engine)
  16. if err := engine.Start(); err != nil {
  17. log.Error("%+v", err)
  18. panic(err)
  19. }
  20. }
  21. // initService init services.
  22. func initService() {
  23. svc = service.New()
  24. }
  25. // router init inner router api path.
  26. func router(e *bm.Engine) {
  27. //init api
  28. e.GET("/monitor/ping", ping)
  29. }
  30. // ping check server ok.
  31. func ping(c *bm.Context) {
  32. }