自定义HTTP配置
最后更新于:2022-04-02 07:27:07
直接像这样使用`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()
}
```
';