http.go 864 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package http
  2. import (
  3. "go-common/app/interface/main/app-player/conf"
  4. "go-common/app/interface/main/app-player/service"
  5. bm "go-common/library/net/http/blademaster"
  6. "go-common/library/net/http/blademaster/middleware/auth"
  7. "go-common/library/net/http/blademaster/middleware/verify"
  8. "go-common/library/stat/prom"
  9. )
  10. var (
  11. svr *service.Service
  12. ver *verify.Verify
  13. ah *auth.Auth
  14. errCount = prom.BusinessErrCount
  15. )
  16. // Init init http
  17. func Init(c *conf.Config) {
  18. initService(c)
  19. engine := bm.DefaultServer(nil)
  20. outerRouter(engine)
  21. if err := engine.Start(); err != nil {
  22. panic(err)
  23. }
  24. }
  25. func initService(c *conf.Config) {
  26. svr = service.New(c)
  27. ver = verify.New(nil)
  28. ah = auth.New(nil)
  29. }
  30. func outerRouter(e *bm.Engine) {
  31. e.Ping(ping)
  32. e.GET("/x/playurl", ver.Verify, ah.GuestMobile, playurl)
  33. }
  34. // Ping is
  35. func ping(ctx *bm.Context) {
  36. }