You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
587 B

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
  1. package cmd
  2. import (
  3. "context"
  4. "practice_Go/internal/controller/channel"
  5. "github.com/gogf/gf/v2/frame/g"
  6. "github.com/gogf/gf/v2/net/ghttp"
  7. "github.com/gogf/gf/v2/os/gcmd"
  8. )
  9. var (
  10. Main = gcmd.Command{
  11. Name: "main",
  12. Usage: "main",
  13. Brief: "start http server",
  14. Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
  15. s := g.Server()
  16. s.Group("/", func(group *ghttp.RouterGroup) {
  17. group.Middleware(ghttp.MiddlewareHandlerResponse)
  18. group.Bind(
  19. channel.NewV1(),
  20. )
  21. })
  22. s.SetServerRoot("resource/public")
  23. s.Run()
  24. return nil
  25. },
  26. }
  27. )