Updates read
This commit is contained in:
parent
44978ff780
commit
3d002e3823
12
README.md
12
README.md
@ -23,9 +23,11 @@ import "github.com/gin-gonic/gin"
|
|||||||
func main() {
|
func main() {
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
r.GET("/ping", func(c *gin.Context) {
|
r.GET("/ping", func(c *gin.Context) {
|
||||||
c.String(200, "pong")
|
c.JSON(200, gin.H{
|
||||||
|
"message": "hello world",
|
||||||
|
})
|
||||||
})
|
})
|
||||||
r.Run(":8080") // listen and serve on 0.0.0.0:8080
|
r.Run() // listen and server on 0.0.0.0:8080
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -110,8 +112,10 @@ func main() {
|
|||||||
router.HEAD("/someHead", head)
|
router.HEAD("/someHead", head)
|
||||||
router.OPTIONS("/someOptions", options)
|
router.OPTIONS("/someOptions", options)
|
||||||
|
|
||||||
// Listen and server on 0.0.0.0:8080
|
// By default it serves on :8080 unless a
|
||||||
router.Run(":8080")
|
// PORT environment variable was defined.
|
||||||
|
router.Run()
|
||||||
|
// router.Run.Run(":3000") for a hard coded port
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user