The fastest full-featured web framework for Golang. Crystal clear.
Gin is a web framework written in Golang. It features a martini-like API with much better performance, up to 40 times faster. If you need performance and good productivity, you will love Gin.
You can add global, per-group, and per-route middlewares, thousands of nested groups, nice JSON validation and rendering. And the performance will be still great. Gin uses httprouter internally, the fastest HTTP router for Golang. Httprouter was created by Julien Schmidt and it’s based in a Radix Tree algorithm.
If you used Martini before, Gin will be familiar to you. If you don’t, you will need 10 minutes to learn everything.
Check out theMore coming soon
If you used Martini before, Gin will be familiar to you. If you don’t, you will need 10 minutes to learn everything.
Radix tree based routing, small memory foot print. No reflection. Predictable API performance.
A incoming HTTP request can by handled by a chain of middlewares and the final action.
For example: Logger, Authorization, GZIP and finally post a message in the DB.
Gin can catch a panic occurred during a HTTP request and recover it. This way, your server will be always available. It’s also possible to report this panic to Sentry for example!
Gin can parse and validate the JSON of a request, checking for example the existence of required values.
Organize your routes better. Authorization required vs non required, different API versions... In addition, the groups can be nested unlimitedly without degrading performance.
Gin provides a convenient way to collect all the errors occurred during a HTTP request. Eventually, a middleware can write them to a log file, to a database and send them through the network.
Gin provides a easy to use API for JSON, XML and HTML rendering.
Creating a new middleware is so easy, just check out the sample codes.
Gin uses a MIT license, this means that you can do whatever you want, but please, keep the reference to the original authors! To contribute you should fork it in Github, add some changes and start posting Pull Requests, we would love to merge them.