http.go 686 B

123456789101112131415161718192021222324252627282930313233343536
  1. package http
  2. import (
  3. "go-common/app/job/main/click/conf"
  4. "go-common/app/job/main/click/service"
  5. "go-common/library/log"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. var srv *service.Service
  9. func Init(c *conf.Config, s *service.Service) {
  10. srv = s
  11. e := bm.DefaultServer(c.BM)
  12. innerRouter(e)
  13. // init internal server
  14. if err := e.Start(); err != nil {
  15. log.Error("bm.DefaultServer error(%v)", err)
  16. panic(err)
  17. }
  18. }
  19. // ping check server ok.
  20. func ping(c *bm.Context) {}
  21. // innerRouter init inner router.
  22. func innerRouter(e *bm.Engine) {
  23. e.Ping(ping)
  24. // path
  25. g := e.Group("/x/internal/click")
  26. {
  27. g.GET("", click)
  28. g.GET("/lock", lock)
  29. g.GET("/lock/mid", lockMid)
  30. }
  31. }