summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/labstack/echo/cookbook/graceful-shutdown/graceful/server.go
blob: 39e7b634a6c1299a7468d2de122a66b28af6683c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 {
		return c.String(http.StatusOK, "Sue sews rose on slow joe crows nose")
	})
	e.Server.Addr = ":1323"

	// Serve it like a boss
	graceful.ListenAndServe(e.Server, 5*time.Second)
}