mirror of https://github.com/gin-gonic/gin.git
Merge branch 'master' of https://github.com/julienschmidt/gin into julienschmidt-master
Conflicts: README.md
This commit is contained in:
commit
e2ecb03c16
|
@ -43,6 +43,8 @@ import "github.com/gin-gonic/gin"
|
||||||
|
|
||||||
#### Create most basic PING/PONG HTTP endpoint
|
#### Create most basic PING/PONG HTTP endpoint
|
||||||
```go
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
import "github.com/gin-gonic/gin"
|
import "github.com/gin-gonic/gin"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -267,6 +269,7 @@ You can also use your own html template render
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import "html/template"
|
import "html/template"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
html := template.Must(template.ParseFiles("file1", "file2"))
|
html := template.Must(template.ParseFiles("file1", "file2"))
|
||||||
|
@ -307,7 +310,7 @@ func main() {
|
||||||
r.Use(Logger())
|
r.Use(Logger())
|
||||||
|
|
||||||
r.GET("/test", func(c *gin.Context) {
|
r.GET("/test", func(c *gin.Context) {
|
||||||
example := c.MustGet("example").(string)
|
example := r.Get("example").(string)
|
||||||
|
|
||||||
// it would print: "12345"
|
// it would print: "12345"
|
||||||
log.Println(example)
|
log.Println(example)
|
||||||
|
|
Loading…
Reference in New Issue