http.go 676 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package http
  2. import (
  3. "go-common/app/job/main/account-recovery/conf"
  4. "go-common/app/job/main/account-recovery/service"
  5. "go-common/library/log"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. var (
  9. srv *service.Service
  10. )
  11. // Init init
  12. func Init(c *conf.Config) {
  13. srv = service.New(c)
  14. engine := bm.DefaultServer(c.BM)
  15. router(engine)
  16. if err := engine.Start(); err != nil {
  17. log.Error("engine.Start error(%v)", err)
  18. panic(err)
  19. }
  20. }
  21. func router(e *bm.Engine) {
  22. e.Ping(ping)
  23. e.Register(register)
  24. g := e.Group("/x/account-recovery")
  25. {
  26. g.GET("/test", ping)
  27. }
  28. }
  29. func ping(c *bm.Context) {
  30. }
  31. func register(c *bm.Context) {
  32. c.JSON(map[string]interface{}{}, nil)
  33. }