Update README.md

This commit is contained in:
邓智杰 2017-04-22 12:21:30 +08:00 committed by GitHub
parent e2212d40c6
commit a89bf0d400

View File

@ -1,5 +1,4 @@
# Gin Web Framework
#Gin Web Framework
<img align="right" src="https://raw.githubusercontent.com/gin-gonic/gin/master/logo.jpg"> <img align="right" src="https://raw.githubusercontent.com/gin-gonic/gin/master/logo.jpg">
[![Build Status](https://travis-ci.org/gin-gonic/gin.svg)](https://travis-ci.org/gin-gonic/gin) [![Build Status](https://travis-ci.org/gin-gonic/gin.svg)](https://travis-ci.org/gin-gonic/gin)
@ -81,7 +80,6 @@ BenchmarkZeus_GithubAll | 2000 | 944234 | 300688 | 2648
- [x] Battle tested - [x] Battle tested
- [x] API frozen, new releases will not break your code. - [x] API frozen, new releases will not break your code.
## Start using it ## Start using it
1. Download and install it: 1. Download and install it:
@ -153,6 +151,7 @@ func main() {
``` ```
#### Querystring parameters #### Querystring parameters
```go ```go
func main() { func main() {
router := gin.Default() router := gin.Default()
@ -247,6 +246,7 @@ func main() {
``` ```
#### Grouping routes #### Grouping routes
```go ```go
func main() { func main() {
router := gin.Default() router := gin.Default()
@ -285,8 +285,8 @@ instead of
r := gin.Default() r := gin.Default()
``` ```
#### Using middleware #### Using middleware
```go ```go
func main() { func main() {
// Creates a router without any middleware by default // Creates a router without any middleware by default
@ -371,8 +371,8 @@ func main() {
} }
``` ```
### Multipart/Urlencoded binding
###Multipart/Urlencoded binding
```go ```go
package main package main
@ -410,7 +410,6 @@ Test it with:
$ curl -v --form user=user --form password=password http://localhost:8080/login $ curl -v --form user=user --form password=password http://localhost:8080/login
``` ```
#### XML, JSON and YAML rendering #### XML, JSON and YAML rendering
```go ```go
@ -543,7 +542,6 @@ func main() {
} }
``` ```
#### Redirects #### Redirects
Issuing a HTTP redirect is easy: Issuing a HTTP redirect is easy:
@ -597,6 +595,7 @@ func main() {
``` ```
#### Using BasicAuth() middleware #### Using BasicAuth() middleware
```go ```go
// simulate some private data // simulate some private data
var secrets = gin.H{ var secrets = gin.H{
@ -634,8 +633,8 @@ func main() {
} }
``` ```
#### Goroutines inside a middleware #### Goroutines inside a middleware
When starting inside a middleware or handler, you **SHOULD NOT** use the original context inside it, you have to use a read-only copy. When starting inside a middleware or handler, you **SHOULD NOT** use the original context inside it, you have to use a read-only copy.
```go ```go
@ -731,3 +730,4 @@ Awesome project lists using [Gin](https://github.com/gin-gonic/gin) web framewor
* [drone](https://github.com/drone/drone): Drone is a Continuous Delivery platform built on Docker, written in Go * [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. * [gorush](https://github.com/appleboy/gorush): A push notification server written in Go.