Gin Gonic

The fastest full-featured web framework for Golang. Crystal clear.

API REFERENCE

$ go get github.com/gin-gonic/gin

Performance and productivity can work together

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.

Martini vs Gin

2,3 GHz Intel Core i7 8 GB 1600 MHz DDR3,  OS X 10.9.3

Check out the benchmark suite

Low Overhead Powerful API

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.

Some cool middlewares

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 the
Sentry midDlEware

More coming soon

Crystal Clear

If you used Martini before, Gin will be familiar to you. If you don’t, you will need 10 minutes to learn everything.

539f93b8f281585418675d91_sample1.png
539f93ccf281585418675d92_sample11.png

More examples in the README.md

Full Featured

Fast

Radix tree based routing, small memory foot print. No reflection. Predictable API performance. 

Middleware support

A incoming HTTP request can be handled by a chain of middlewares and the final action.
For example: Logger, Authorization, GZIP and finally post a message in the DB.

Crash-free

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!

JSON validation

Gin can parse and validate the JSON of a request, checking for example the existence of required values.

Routes grouping

Organize your routes better. Authorization required vs non required, different API versions... In addition, the groups can be nested unlimitedly without degrading performance.

Error management

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.

Rendering built-in

Gin provides a easy to use API for JSON, XML and HTML rendering.

Extendable

Creating a new middleware is so easy, just check out the sample codes.

How to contribute?

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.

1. Fork
539e4fca30eda3837a903182_Git-Icon-Black2.png
2. Commit
539e4fbbaa3db5690ebc0c8c_idea2.png
3. Pull request
539e4fadaa3db5690ebc0c8b_pull2.png