update readme: add YAML example.
This commit is contained in:
parent
3c3526f1f1
commit
e67cd9185e
@ -412,7 +412,7 @@ $ curl -v --form user=user --form password=password http://localhost:8080/login
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### XML and JSON rendering
|
#### XML, JSON and YAML rendering
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func main() {
|
func main() {
|
||||||
@ -442,6 +442,10 @@ func main() {
|
|||||||
c.XML(http.StatusOK, gin.H{"message": "hey", "status": http.StatusOK})
|
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
|
// Listen and server on 0.0.0.0:8080
|
||||||
r.Run(":8080")
|
r.Run(":8080")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user