Add document about graceful restart or stop

I am looking for a long time , add this document will
help who were looking for graceful restart/stop like me.

Signed-off-by: ZhiFeng Hu <hufeng1987@gmail.com>
This commit is contained in:
ZhiFeng Hu 2015-11-11 10:27:36 +08:00
parent 52fcc5dbf6
commit 8b000c5a04
1 changed files with 19 additions and 0 deletions

View File

@ -609,3 +609,22 @@ func main() {
s.ListenAndServe()
}
```
#### Graceful restart or stop
Do you want to graceful restart or stop your web server?
There be some ways.
We can using fvbock/endless to replace the default ListenAndServe
Refer the issue for more details:
https://github.com/gin-gonic/gin/issues/296
```go
router := gin.Default()
router.GET("/", handler)
// [...]
endless.ListenAndServe(":4242", router)
```