프로젝트
GitHub에서 보기
tabalt/gracehttp
소개
간결하고 우아한 Golang용 HTTP 서버
시스템 및 인프라측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalgracehttp
This is a simple and graceful HTTP server for Golang.
Version
V1.2.0 (Require Go 1.8+)
Usage
package main
import (
"fmt"
"net/http"
"github.com/tabalt/gracehttp"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "hello world")
})
err := gracehttp.ListenAndServe(":8080", nil)
if err != nil {
fmt.Println(err)
}
}
Demo
Install the demo application
go get github.com/tabalt/gracehttp/gracehttpdemoStart it in the first terminal
gracehttpdemoThis will output something like:
2015/09/14 20:01:08 Serving :8080 with pid 4388.In a second terminal start a slow HTTP request
curl 'http://localhost:8080/sleep/?duration=20s'In a third terminal trigger a graceful server restart (using the pid from your output):
kill -SIGUSR2 $pidTrigger another shorter request that finishes before the earlier request:
curl 'http://localhost:8080/sleep/?duration=0s'
관련 프로젝트 살펴보기
불러오는 중…