gin自定义HTTP配置
生活随笔
收集整理的這篇文章主要介紹了
gin自定义HTTP配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
gin自定義HTTP配置
直接像這樣使用http.ListenAndServe()
func main() {router := gin.Default()http.ListenAndServe(":8080", router) }或者
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() } 《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的gin自定义HTTP配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: golang中的base64
- 下一篇: gin中间件中使用Goroutines