diff --git a/README.md b/README.md index 99a6d0b..8023dc5 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ BenchmarkZeus_GithubAll | 2000 | 944234 | 300688 | 2648 (3): Heap Memory (B/op) (4): Average Allocations per Repetition (allocs/op) -##Gin v1. stable +## Gin v1. stable - [x] Zero allocation router. - [x] Still the fastest http router and framework. From routing to writing. @@ -84,6 +84,7 @@ BenchmarkZeus_GithubAll | 2000 | 944234 | 300688 | 2648 ## Start using it + 1. Download and install it: ```sh @@ -102,7 +103,7 @@ BenchmarkZeus_GithubAll | 2000 | 944234 | 300688 | 2648 import "net/http" ``` -##API Examples +## API Examples #### Using GET, POST, PUT, PATCH, DELETE and OPTIONS @@ -412,7 +413,7 @@ $ curl -v --form user=user --form password=password http://localhost:8080/login ``` -#### XML and JSON rendering +#### XML, JSON and YAML rendering ```go func main() { @@ -442,6 +443,10 @@ func main() { c.XML(http.StatusOK, gin.H{"message": "hey", "status": http.StatusOK}) }) + r.GET("/someYAML", func(c *gin.Context) { + c.YAML(http.StatusOK, gin.H{"message": "hey", "status": http.StatusOK}) + }) + // Listen and server on 0.0.0.0:8080 r.Run(":8080") } @@ -708,3 +713,10 @@ endless.ListenAndServe(":4242", router) An alternative to endless: * [manners](https://github.com/braintree/manners): A polite Go HTTP server that shuts down gracefully. + +## Example + +Awesome project lists using [Gin](https://github.com/gin-gonic/gin) web framework. + +* [drone](https://github.com/drone/drone): Drone is a Continuous Delivery platform built on Docker, written in Go +* [gorush](https://github.com/appleboy/gorush): A push notification server written in Go. diff --git a/ginS/README.md b/ginS/README.md index c186b1f..ac563a2 100644 --- a/ginS/README.md +++ b/ginS/README.md @@ -11,7 +11,7 @@ import ( ) func main() { - ginS.GET("/", func(c *gin.Context) { c.String("Hello World") }) + ginS.GET("/", func(c *gin.Context) { c.String(200, "Hello World") }) ginS.Run() } ``` diff --git a/mode.go b/mode.go index fcb8f8f..f44b071 100644 --- a/mode.go +++ b/mode.go @@ -5,6 +5,7 @@ package gin import ( + "io" "os" "github.com/gin-gonic/gin/binding" @@ -30,8 +31,8 @@ const ( // To support coloring in Windows use: // import "github.com/mattn/go-colorable" // gin.DefaultWriter = colorable.NewColorableStdout() -var DefaultWriter = os.Stdout -var DefaultErrorWriter = os.Stderr +var DefaultWriter io.Writer = os.Stdout +var DefaultErrorWriter io.Writer = os.Stderr var ginMode = debugCode var modeName = DebugMode