Middlewares
Middlewares and helper modules allow you easily plugin/unplugin features for your Macaron applications.
There are already many middlewares and modules to simplify your work:
auth - HTTP Basic authentication
bindata - Embed binary data as static and template files
binding - Request data binding and validation
cache - Cache manager
captcha - Captcha service
csrf - Generates and validates CSRF tokens
gzip - Gzip compression to all responses
i18n - Internationalization and Localization
inject - Map and inject dependencies
jade - Jade templating engine
method - HTTP method override
oauth2 - OAuth 2.0 backend client
permissions2 - Cookies, users and permissions
pongo2 - Pongo2 template engine support
renders - Beego-like render engine (Macaron has built-in template engine, this is another option)
session - Session manager
sockets - WebSockets channels binding
switcher - Multiple-site support
toolbox - Health check, pprof, profile and statistic services
Best register order for middlewares
Some middlewares depends on others, here is a list for best ordering:
macaron.Logger()
macaron.Recovery()
gzip.Gziper()
macaron.Static()
macaron.Renderer()
/pongo2.Pongoer()
i18n.I18n()
cache.Cacher()
captcha.Captchaer()
session.Sessioner()
csrf.Csrfer()
toolbox.Toolboxer()
Last updated