Macaron: Martini-style, but faster and cheaper
Macaron is a high productive and modular design web framework in Go. It takes basic ideology of Martini and extends in advance.
Why another web framework?
The story began with the Gogs project, it first uses Martini as its web framework, worked quite well. Soon after, our team found that Martini is good but too minimal, also too many reflections that cause performance issue. Finally, I came up an idea that why don’t we just integrate most frequently used middlewares as interfaces(huge reduction for reflection), and replace default router layer with faster one. It turns out Macaron actually requires less memory overhead for every request and faster speed than Martini, and at the same time, it reserves my favorite Martini-style coding.
Examples
If you are using Martini already, you shouldn’t be surprised with following code:
|
|
And here is another simple example:
|
|
How about middlewares?
There are already many middlewares to simplify your work:
- binding - Request data binding and validation
- i18n - Internationalization and Localization
- cache - Cache manager
- session - Session manager
- csrf - Generates and validates csrf tokens
- captcha - Captcha service
- pongo2 - Pongo2 template engine support
- sockets - WebSockets channels binding
- bindata - Embed binary data as static and template files
- toolbox - Health check, pprof, profile and statistic services
- oauth2 - OAuth 2.0 backend
- switcher - Multiple-site support
- method - HTTP method override
- permissions2 - Cookies, users and permissions
- renders - Beego-like render engine(Macaron has built-in template engine, this is another option)
Want to know more about Macaron? Check out its documentation site!