From 0808f8a824cfb9aef6ea4fd664af238544b66fc1 Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Sat, 13 Sep 2014 20:37:27 +0200 Subject: [PATCH] Adds logger source code --- README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 67d8d96e..43b19cc0 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,36 @@ [![GoDoc](https://godoc.org/github.com/gin-gonic/gin?status.svg)](https://godoc.org/github.com/gin-gonic/gin) [![Build Status](https://travis-ci.org/gin-gonic/gin.svg)](https://travis-ci.org/gin-gonic/gin) -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. +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. + ![Gin console logger](http://forzefield.com/gin_example.png) +``` +$ cat test.go +``` +```go +package main + +import "github.com/gin-gonic/gin" + +func main() { + router := gin.Default() + router.GET("/", func(c *gin.Context) { + c.String(200, "hello world") + }) + router.GET("/ping", func(c *gin.Context) { + c.String(200, "pong") + }) + router.POST("/submit", func(c *gin.Context) { + c.String(401, "not authorized") + }) + router.PUT("/error", func(c *gin.Context) { + c.String(500, "and error hapenned :(") + }) + router.Run(":8080") +} +``` + ##Gin is new, will it be supported? Yes, Gin is an internal project of [my](https://github.com/manucorporat) upcoming startup. We developed it and we are going to continue using and improve it.