カスタム HTTP 設定

http.ListenAndServe() を以下のように直接使用します。

import "net/http"

func main() {
	router := gin.Default()
	http.ListenAndServe(":8080", router)
}

または

import "net/http"

func main() {
	router := gin.Default()

	s := &http.Server{
		Addr:           ":8080",
		Handler:        router,
		ReadTimeout:    10 * time.Second,
		WriteTimeout:   10 * time.Second,
		MaxHeaderBytes: 1 << 20,
	}
	s.ListenAndServe()
}
最終更新日:2024年5月10日: GitHub action workflows の更新 (#276) (4371021)