Go Apache-2.0

graceful

A best practice http server set up that supports graceful shutdown

O

ory

Dernière activité 28 août 2026
ory/graceful

208

étoiles

20

forks

2

issues ouvertes

Ce README est souvent en anglais.

graceful

Build Status Coverage Status Docs: GoDoc

Join the chat at https://slack.ory.sh/

Best practice http server configurations and helpers for Go 1.8's http graceful shutdown feature. Currently supports best practice configurations by:

Usage

To install this library, do:

go get github.com/ory/graceful

Running Cloudflare Config with Graceful Shutdown

package main

import (
    "net/http"
    "log"

    "github.com/ory/graceful"
)

func main() {
    server := graceful.WithDefaults(&http.Server{
        Addr: ":54932",
        // Handler: someHandler,
    })

    log.Println("main: Starting the server")
    if err := graceful.Graceful(server.ListenAndServe, server.Shutdown); err != nil {
        log.Fatalln("main: Failed to gracefully shutdown")
    }
    log.Println("main: Server was shutdown gracefully")
}

Projets similaires

A non-intrusive, zero dependency library adding a graceful shutdown to Go HTTP servers.

Gofinishgogolang
Ppseidemann
219 étoiles10

A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies

Gogolanggraceful-shutdownhealth-check
33n21c0
169 étoiles41

a go-lang supervisor implementation

Go
Oochinchina
4,3 k étoiles630