本教材由知了传课辛苦制作而成,仅供学习使用,请勿用于商业用途!如进行转载请务必注明出处!谢谢!

自定义HTTP配置

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() }

1359人已阅读,今天你学习了吗?

添加新回复
目录