diff --git a/examples/grace/server.go b/examples/grace/server.go new file mode 100644 index 00000000..fee4ffae --- /dev/null +++ b/examples/grace/server.go @@ -0,0 +1,20 @@ +package main + +import ( + "net/http" + + "github.com/facebookgo/grace/gracehttp" + "github.com/labstack/echo" +) + +func main() { + // Setup + e := echo.New() + e.Get("/", func(c *echo.Context) error { + c.String(http.StatusOK, "Six sick bricks tick") + return nil + }) + + // Use github.com/facebookgo/grace/gracehttp + gracehttp.Serve(e.Server(":1323")) +} diff --git a/examples/graceful/server.go b/examples/graceful/server.go new file mode 100644 index 00000000..2c862c92 --- /dev/null +++ b/examples/graceful/server.go @@ -0,0 +1,21 @@ +package main + +import ( + "net/http" + "time" + + "github.com/labstack/echo" + "github.com/tylerb/graceful" +) + +func main() { + // Setup + e := echo.New() + e.Get("/", func(c *echo.Context) error { + c.String(http.StatusOK, "Sue sews rose on slow jor crows nose") + return nil + }) + + // Use github.com/tylerb/graceful + graceful.ListenAndServe(e.Server(":1323"), 5*time.Second) +}