1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-24 03:16:14 +02:00

Example usage of echo with github.com/facebookgo/grace/gracehttp and github.com/tylerb/graceful

This commit is contained in:
Merten van Gerven 2015-06-28 14:35:17 +02:00
parent 07c0cf21f0
commit 33eb3fb67b
2 changed files with 41 additions and 0 deletions

20
examples/grace/server.go Normal file
View File

@ -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"))
}

View File

@ -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)
}