From 8b000c5a04845fbc6e6783083ec4bb39a006e1ed Mon Sep 17 00:00:00 2001 From: ZhiFeng Hu Date: Wed, 11 Nov 2015 10:27:36 +0800 Subject: [PATCH] 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 --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index e83952d6..d8f44c22 100644 --- a/README.md +++ b/README.md @@ -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) + +```