mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-17 22:32:26 +08:00
Merge branch 'master' into use-duration-truncate
This commit is contained in:
commit
ec030a0957
13
README.md
13
README.md
@ -24,6 +24,7 @@ Gin is a web framework written in Go (Golang). It features a martini-like API wi
|
|||||||
- [Benchmarks](#benchmarks)
|
- [Benchmarks](#benchmarks)
|
||||||
- [Gin v1. stable](#gin-v1-stable)
|
- [Gin v1. stable](#gin-v1-stable)
|
||||||
- [Build with jsoniter/go-json](#build-with-json-replacement)
|
- [Build with jsoniter/go-json](#build-with-json-replacement)
|
||||||
|
- [Build without `MsgPack` rendering feature](#build-without-msgpack-rendering-feature)
|
||||||
- [API Examples](#api-examples)
|
- [API Examples](#api-examples)
|
||||||
- [Using GET, POST, PUT, PATCH, DELETE and OPTIONS](#using-get-post-put-patch-delete-and-options)
|
- [Using GET, POST, PUT, PATCH, DELETE and OPTIONS](#using-get-post-put-patch-delete-and-options)
|
||||||
- [Parameters in path](#parameters-in-path)
|
- [Parameters in path](#parameters-in-path)
|
||||||
@ -195,6 +196,16 @@ $ go build -tags=jsoniter .
|
|||||||
$ go build -tags=go_json .
|
$ go build -tags=go_json .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Build without `MsgPack` rendering feature
|
||||||
|
|
||||||
|
Gin enables `MsgPack` rendering feature by default. But you can disable this feature by specifying `nomsgpack` build tag.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ go build -tags=nomsgpack .
|
||||||
|
```
|
||||||
|
|
||||||
|
This is useful to reduce the binary size of executable files. See the [detail information](https://github.com/gin-gonic/gin/pull/1852).
|
||||||
|
|
||||||
## API Examples
|
## API Examples
|
||||||
|
|
||||||
You can find a number of ready-to-run examples at [Gin examples repository](https://github.com/gin-gonic/examples).
|
You can find a number of ready-to-run examples at [Gin examples repository](https://github.com/gin-gonic/examples).
|
||||||
@ -930,7 +941,7 @@ func main() {
|
|||||||
route.GET("/:name/:id", func(c *gin.Context) {
|
route.GET("/:name/:id", func(c *gin.Context) {
|
||||||
var person Person
|
var person Person
|
||||||
if err := c.ShouldBindUri(&person); err != nil {
|
if err := c.ShouldBindUri(&person); err != nil {
|
||||||
c.JSON(400, gin.H{"msg": err})
|
c.JSON(400, gin.H{"msg": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.JSON(200, gin.H{"name": person.Name, "uuid": person.ID})
|
c.JSON(200, gin.H{"name": person.Name, "uuid": person.ID})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user