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.

39 lines
878 B

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. package cmd
  2. import (
  3. "context"
  4. "github.com/gogf/gf/v2/frame/g"
  5. "github.com/gogf/gf/v2/net/ghttp"
  6. "github.com/gogf/gf/v2/os/gcmd"
  7. "link_homework/internal/controller/auth"
  8. "link_homework/internal/logic/middleware"
  9. )
  10. var (
  11. Main = gcmd.Command{
  12. Name: "main",
  13. Usage: "main",
  14. Brief: "start http server",
  15. Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
  16. s := g.Server()
  17. //后台
  18. s.Group("/api", func(group *ghttp.RouterGroup) {
  19. // 登录接口
  20. group.POST("/login", auth.NewLoginController().Login)
  21. // 退出接口
  22. group.POST("/logout", auth.NewLoginController().Logout)
  23. })
  24. s.Group("/api/homework_manage", func(group *ghttp.RouterGroup) {
  25. group.Middleware(middleware.JWTMiddleware)
  26. })
  27. //客户端
  28. s.Group("/api/homework_client", func(group *ghttp.RouterGroup) {
  29. })
  30. s.Run()
  31. return nil
  32. },
  33. }
  34. )