server: shutdown endpoint (#466)

fixes #390
This commit is contained in:
C Cirello
2016-12-29 20:19:42 +01:00
committed by GitHub
parent c2c2a0fb06
commit e3c85d3e7e
5 changed files with 42 additions and 3 deletions

15
api/server/shutdown.go Normal file
View File

@@ -0,0 +1,15 @@
package server
import (
"context"
"net/http"
"github.com/gin-gonic/gin"
)
func (s *Server) handleShutdown(halt context.CancelFunc) func(*gin.Context) {
return func(c *gin.Context) {
halt()
c.JSON(http.StatusOK, "shutting down")
}
}