Macaron Documentation
  • Welcome
  • Starter Guide
  • Core Concepts
  • Core Services
  • Custom Services
  • Middlewares
    • Routing
    • Templating
    • Gzip
    • Localization
    • Data Binding and Validation
    • Cache
    • Captcha
    • Session
    • Cross-Site Request Forgery
    • Embed Binary Data
    • Serving Multiple Sites
  • FAQs
  • 简体中文
    • 初学者指南
    • 核心概念
    • 核心服务
    • 自定义服务
    • 中间件和辅助模块
      • 路由模块
      • 模板引擎
      • Gzip 压缩
      • 应用本地化
      • 数据绑定与验证
      • 缓存管理(Cache)
      • 验证码服务
      • 会话管理(Session)
      • 跨域请求攻击(CSRF)
      • 嵌入二进制数据
      • 服务多个站点
    • 常见问题
Powered by GitBook
On this page

Was this helpful?

  1. 简体中文

中间件和辅助模块

Previous自定义服务Next路由模块

Last updated 5 years ago

Was this helpful?

中间件及辅助模块允许您轻易地对模块的进行接入到您的 Macaron 应用中。

现在已经有许多 来简化您的工作:

  • - HTTP 基本认证

  • - ACL、RBAC 和 ABAC 的权限管理,基于

  • - 嵌入二进制数据作为静态资源和模板文件

  • - 请求数据绑定和校验

  • - Cache 管理器

  • - 验证码服务

  • - 生成和验证 CSRF 令牌

  • - Gzip 压缩所有响应

  • - 国际化与本地化

  • - 映射和注入依赖

  • - Jade 模板引擎

  • - HTTP 方法覆盖

  • - OAuth 2.0 后端客户端

  • - Cookies、多用户和权限管理

  • - Pongo2 模板引擎

  • - 类 Beego 模板引擎(Macaron 已有内置模板引擎,此为可选)

  • - Session 管理器

  • - WebSockets 管道绑定

  • - 多站点支持

  • - 健康检查、性能调试和路由统计等服务

注册中间件的最佳顺序

有些中间件会依赖其它中间件,以下为最佳的注册顺序列表:

  1. macaron.Logger()

  2. macaron.Recovery()

  3. gzip.Gziper()

  4. macaron.Static()

  5. macaron.Renderer()/pongo2.Pongoer()

  6. i18n.I18n()

  7. cache.Cacher()

  8. captcha.Captchaer()

  9. session.Sessioner()

  10. csrf.Csrfer()

  11. toolbox.Toolboxer()

中间件和辅助模块
auth
authz
Casbin
bindata
binding
cache
captcha
csrf
gzip
i18n
inject
jade
method
oauth2
permissions2
pongo2
renders
session
sockets
switcher
toolbox