mirror of
https://github.com/labstack/echo.git
synced 2025-02-07 13:31:38 +02:00
parent
ee2ac3b9a2
commit
c935874aa8
@ -39,7 +39,7 @@ a custom logger using `Echo#Logger`.
|
||||
|
||||
## Custom Server
|
||||
|
||||
`Echo#StartServer()` can be used to run a custom `http.Server`.
|
||||
### Using `Echo#StartServer()`
|
||||
|
||||
*Example*
|
||||
|
||||
@ -52,6 +52,25 @@ s := &http.Server{
|
||||
e.Logger.Fatal(e.StartServer(s))
|
||||
```
|
||||
|
||||
### Using `http.ListenAndServe*()`
|
||||
|
||||
|
||||
*Example*
|
||||
|
||||
```go
|
||||
e := echo.New()
|
||||
e.GET("/", func(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, "OK")
|
||||
})
|
||||
s := &http.Server{
|
||||
Handler: e,
|
||||
Addr: ":1323",
|
||||
}
|
||||
e.Logger.Fatal(s.ListenAndServe())
|
||||
```
|
||||
|
||||
> This setup will bypass auto-tls and graceful shutdown.
|
||||
|
||||
## Disable HTTP/2
|
||||
|
||||
`Echo#DisableHTTP2` can be used disable HTTP/2 protocol.
|
||||
|
Loading…
x
Reference in New Issue
Block a user