go-zero 单体应用框架原理学习—1 路由相关的存储
发布日期:2021-05-14 20:12:13 浏览次数:15 分类:精选文章

本文共 2415 字,大约阅读时间需要 8 分钟。

go-zero ���������������������������������������

������������������������������������

��� go-zero ���������������������������������������������������������������������������

  • ���������������������

    • ��������������������� Route ���������������������������������������
      type Route struct {
      Method string
      Path string
      Hander http.HandlerFunc
      }
    • Method ��������������������������� GET���POST������
    • Path ���������������������������
    • Hander ��������� http.HandlerFunc ������������������������������������������������
  • ������������������������

    • ��������������������������� featuredRoutes ������������ routes ���������������������������������������������������������������������������������������������������������
      type featuredRoutes struct {
      routes []Route // ������������������������
      // ������������������������jwt������������
      }
  • ���������������������������

    • ��������������������������������������� Server ��������� nginx.routes ������������������������������������������
  • ������������������

    ��� go-zero ���������������������������������������������������������������������������

  • ���������������

    • ������ handler.RegisterHandlers(server, ctx) ���������������������
    • ���������������������������������������������������������������������������������������������������
  • ���������������������

    • ������������������������������������������������������������������������������������
    • ��������������������������������������������������� Handler ���������
  • handler ������������

    ���������������������������������Handler ������������������������������������������

  • ������ ServeHTTP ��������������������� http ���������

  • ������������������������������������������������������������������������

    type Handler interface {
    ServeHTTP(http.ResponseWriter, *http.Request)
    }
  • ���������������������������

  • ���������������������������

    type EngineWithMiddlewares struct {
    handler Handler
    middlewares []Middleware
    }
  • ������������������������

    • ���������������������������������������
    • ���������������������������������������������������������������
    • ���������������������������������������������������������������
  • ���������������������������������

    ���������������������������������go-zero ��������������������������������������������������������������������������������������� High Stockholm ������������������������������������������������������������������������������������������������������������������������������������

    上一篇:go-zero 单体应用框架学习—2 中间件的添加和原理
    下一篇:第五课 golang的流程控制

    发表评论

    最新留言

    初次前来,多多关照!
    [***.217.46.12]2025年04月17日 03时18分22秒