mirror of
https://github.com/labstack/echo.git
synced 2025-01-12 01:22:21 +02:00
Updated readme
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
65f3fcbfe2
commit
37a2533ad4
10
README.md
10
README.md
@ -28,11 +28,11 @@
|
||||
|
||||
![Performance](https://i.imgur.com/F2V7TfO.png)
|
||||
|
||||
## [Get Started](https://echo.labstack.com/guide)
|
||||
## [Guide](https://echo.labstack.com/guide)
|
||||
|
||||
### Example:
|
||||
## Example
|
||||
|
||||
```
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
@ -45,11 +45,14 @@ import (
|
||||
func main() {
|
||||
// Echo instance
|
||||
e := echo.New()
|
||||
|
||||
// Middleware
|
||||
e.Use(middleware.Logger())
|
||||
e.Use(middleware.Recover())
|
||||
|
||||
// Routes
|
||||
e.GET("/", hello)
|
||||
|
||||
// Start server
|
||||
e.Logger.Fatal(e.Start(":1323"))
|
||||
}
|
||||
@ -58,7 +61,6 @@ func main() {
|
||||
func hello(c echo.Context) error {
|
||||
return c.String(http.StatusOK, "Hello, World!")
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Support Us
|
||||
|
@ -88,6 +88,7 @@ func BasicAuthWithConfig(config BasicAuthConfig) echo.MiddlewareFunc {
|
||||
} else if valid {
|
||||
return next(c)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ func HTTPSRedirect() echo.MiddlewareFunc {
|
||||
// HTTPSRedirectWithConfig returns an HTTPSRedirect middleware with config.
|
||||
// See `HTTPSRedirect()`.
|
||||
func HTTPSRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc {
|
||||
return redirect(config, func(isTLS bool, _, host, uri string) (ok bool, url string) {
|
||||
if ok = !isTLS; ok {
|
||||
return redirect(config, func(tls bool, _, host, uri string) (ok bool, url string) {
|
||||
if ok = !tls; ok {
|
||||
url = "https://" + host + uri
|
||||
}
|
||||
return
|
||||
@ -59,8 +59,8 @@ func HTTPSWWWRedirect() echo.MiddlewareFunc {
|
||||
// HTTPSWWWRedirectWithConfig returns an HTTPSRedirect middleware with config.
|
||||
// See `HTTPSWWWRedirect()`.
|
||||
func HTTPSWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc {
|
||||
return redirect(config, func(isTLS bool, _, host, uri string) (ok bool, url string) {
|
||||
if ok = !isTLS && host[:3] != www; ok {
|
||||
return redirect(config, func(tls bool, _, host, uri string) (ok bool, url string) {
|
||||
if ok = !tls && host[:3] != www; ok {
|
||||
url = "https://www." + host + uri
|
||||
}
|
||||
return
|
||||
@ -78,8 +78,8 @@ func HTTPSNonWWWRedirect() echo.MiddlewareFunc {
|
||||
// HTTPSNonWWWRedirectWithConfig returns an HTTPSRedirect middleware with config.
|
||||
// See `HTTPSNonWWWRedirect()`.
|
||||
func HTTPSNonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc {
|
||||
return redirect(config, func(isTLS bool, _, host, uri string) (ok bool, url string) {
|
||||
if ok = !isTLS; ok {
|
||||
return redirect(config, func(tls bool, _, host, uri string) (ok bool, url string) {
|
||||
if ok = !tls; ok {
|
||||
if host[:3] == www {
|
||||
host = host[4:]
|
||||
}
|
||||
@ -119,7 +119,7 @@ func NonWWWRedirect() echo.MiddlewareFunc {
|
||||
// NonWWWRedirectWithConfig returns an HTTPSRedirect middleware with config.
|
||||
// See `NonWWWRedirect()`.
|
||||
func NonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc {
|
||||
return redirect(config, func(isTLS bool, scheme, host, uri string) (ok bool, url string) {
|
||||
return redirect(config, func(tls bool, scheme, host, uri string) (ok bool, url string) {
|
||||
if ok = host[:3] == www; ok {
|
||||
url = scheme + "://" + host[4:] + uri
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user