diff --git a/echo.go b/echo.go index f23a541c..31db13ee 100644 --- a/echo.go +++ b/echo.go @@ -1,5 +1,5 @@ /* -Package echo implements a fast and unfancy HTTP server framework for Go (Golang). +Package echo implements high performance, minimalist Go web framework. Example: diff --git a/recipe/auto-tls/server.go b/recipe/auto-tls/server.go new file mode 100644 index 00000000..61300d7b --- /dev/null +++ b/recipe/auto-tls/server.go @@ -0,0 +1,21 @@ +package main + +import ( + "net/http" + + "github.com/labstack/echo" + "github.com/labstack/echo/middleware" +) + +func main() { + e := echo.New() + e.Use(middleware.Recover()) + e.Use(middleware.Logger()) + e.GET("/", func(c echo.Context) error { + return c.HTML(http.StatusOK, ` +

Welcome to Echo!

+

TLS certificates automatically installed from Let's Encrypt :)

+ `) + }) + e.StartAutoTLS(":443", []string{""}, "le.cache") +} diff --git a/website/config.json b/website/config.json index 9aa7119e..a7b18c7f 100644 --- a/website/config.json +++ b/website/config.json @@ -1,7 +1,7 @@ { "baseurl": "https://echo.labstack.com", "languageCode": "en-us", - "title": "Echo - Fast and Unfancy Go Web Framework", + "title": "Echo - High performance, minimalist Go web framework", "canonifyurls": true, "googleAnalytics": "UA-85059636-2", "permalinks": { diff --git a/website/content/guide/context.md b/website/content/guide/context.md index b14194e9..e759700f 100644 --- a/website/content/guide/context.md +++ b/website/content/guide/context.md @@ -3,7 +3,6 @@ title = "Context" description = "Context in Echo" [menu.main] name = "Context" - identifier = "context" parent = "guide" weight = 5 +++ diff --git a/website/content/middleware/basic-auth.md b/website/content/middleware/basic-auth.md index e68e9c5d..8fa6861d 100644 --- a/website/content/middleware/basic-auth.md +++ b/website/content/middleware/basic-auth.md @@ -1,13 +1,13 @@ +++ -title = "BasicAuth Middleware" +title = "Basic Auth Middleware" description = "Basic auth middleware for Echo" [menu.main] - name = "BasicAuth" + name = "Basic Auth" parent = "middleware" weight = 5 +++ -BasicAuth middleware provides an HTTP basic authentication. +Basic auth middleware provides an HTTP basic authentication. - For valid credentials it calls the next handler. - For invalid credentials, it sends "401 - Unauthorized" response. diff --git a/website/content/middleware/body-limit.md b/website/content/middleware/body-limit.md index 6f4dbbb7..562ca15c 100644 --- a/website/content/middleware/body-limit.md +++ b/website/content/middleware/body-limit.md @@ -1,13 +1,13 @@ +++ -title = "BodyLimit Middleware" +title = "Body Limit Middleware" description = "Body limit middleware for Echo" [menu.main] - name = "BodyLimit" + name = "Body Limit" parent = "middleware" weight = 5 +++ -BodyLimit middleware sets the maximum allowed size for a request body, if the +Body limit middleware sets the maximum allowed size for a request body, if the size exceeds the configured limit, it sends "413 - Request Entity Too Large" response. The body limit is determined based on both `Content-Length` request header and actual content read, which makes it super secure. diff --git a/website/content/middleware/method-override.md b/website/content/middleware/method-override.md index 8dbb52d9..d71400e7 100644 --- a/website/content/middleware/method-override.md +++ b/website/content/middleware/method-override.md @@ -1,13 +1,13 @@ +++ -title = "MethodOverride Middleware" +title = "Method Override Middleware" description = "Method override middleware for Echo" [menu.main] - name = "MethodOverride" + name = "Method Override" parent = "middleware" weight = 5 +++ -MethodOverride middleware checks for the overridden method from the request and +Method override middleware checks for the overridden method from the request and uses it instead of the original method. For security reasons, only `POST` method can be overridden. diff --git a/website/content/middleware/redirect.md b/website/content/middleware/redirect.md index c85b1d56..ec921749 100644 --- a/website/content/middleware/redirect.md +++ b/website/content/middleware/redirect.md @@ -7,9 +7,9 @@ description = "Redirect middleware for Echo" weight = 5 +++ -## HTTPSRedirect +## HTTPS Redirect -HTTPSRedirect middleware redirects http requests to https. +HTTPS redirect middleware redirects http requests to https. For example, http://labstack.com will be redirected to https://labstack.com. *Usage* @@ -19,9 +19,9 @@ e := echo.New() e.Pre(middleware.HTTPSRedirect()) ``` -## HTTPSWWWRedirect +## HTTPS WWW Redirect -HTTPSWWWRedirect redirects http requests to www https. +HTTPS WWW redirect redirects http requests to www https. For example, http://labstack.com will be redirected to https://www.labstack.com. *Usage* @@ -31,9 +31,9 @@ e := echo.New() e.Pre(middleware.HTTPSWWWRedirect()) ``` -## HTTPSNonWWWRedirect +## HTTPS NonWWW Redirect -HTTPSNonWWWRedirect redirects http requests to https non www. +HTTPS NonWWW redirect redirects http requests to https non www. For example, http://www.labstack.com will be redirect to https://labstack.com. *Usage* @@ -43,9 +43,9 @@ e := echo.New() e.Pre(middleware.HTTPSNonWWWRedirect()) ``` -## WWWRedirect +## WWW Redirect -WWWRedirect redirects non www requests to www. +WWW redirect redirects non www requests to www. For example, http://labstack.com will be redirected to http://www.labstack.com. @@ -56,9 +56,9 @@ e := echo.New() e.Pre(middleware.WWWRedirect()) ``` -## NonWWWRedirect +## NonWWW Redirect -NonWWWRedirect redirects www requests to non www. +NonWWW redirect redirects www requests to non www. For example, http://www.labstack.com will be redirected to http://labstack.com. *Usage* diff --git a/website/content/middleware/trailing-slash.md b/website/content/middleware/trailing-slash.md index a460f589..74facc72 100644 --- a/website/content/middleware/trailing-slash.md +++ b/website/content/middleware/trailing-slash.md @@ -1,15 +1,15 @@ +++ -title = "TrailingSlash Middleware" +title = "Trailing Slash Middleware" description = "Trailing slash middleware for Echo" [menu.main] - name = "TrailingSlash" + name = "Trailing Slash" parent = "middleware" weight = 5 +++ -## AddTrailingSlash Middleware +## Add Trailing Slash -AddTrailingSlash middleware adds a trailing slash to the request URI. +Add trailing slash middleware adds a trailing slash to the request URI. *Usage* @@ -18,9 +18,9 @@ e := echo.New() e.Pre(middleware.AddTrailingSlash()) ``` -## RemoveTrailingSlash Middleware +## Remove Trailing Slash -RemoveTrailingSlash middleware removes a trailing slash from the request URI. +Remove trailing slash middleware removes a trailing slash from the request URI. *Usage* diff --git a/website/content/recipes/auto-tls.md b/website/content/recipes/auto-tls.md new file mode 100644 index 00000000..8c40a809 --- /dev/null +++ b/website/content/recipes/auto-tls.md @@ -0,0 +1,29 @@ ++++ +title = "Auto TLS Example" +description = "Automatic TLS certificates from Let's Encrypt example for Echo" +[menu.main] + name = "Auto TLS" + parent = "recipes" + weight = 2 ++++ + +This recipe shows how to obtain TLS certificates for a domain automatically from +Let's Encrypt. `Echo#StartAutoTLS` accepts address which should listen on port `443`, +list of host names for security and a file path to cache the certificates. + +Browse to https://. If everything goes fine, you should see a welcome +message with TLS enabled on the website. + +> To redirect HTTP traffic to HTTPS, you can use [redirect middleware](/middleware/redirect#https-redirect) + +## Server + +`server.go` + +{{< embed "auto-tls/server.go" >}} + +## [Source Code]({{< source "auto-tls" >}}) + +## Maintainers + +- [vishr](https://github.com/vishr) diff --git a/website/content/recipes/cors.md b/website/content/recipes/cors.md index f3279f38..903932f3 100644 --- a/website/content/recipes/cors.md +++ b/website/content/recipes/cors.md @@ -3,7 +3,7 @@ title = "CORS Example" description = "CORS example for Echo" [menu.main] name = "CORS" - identifier = "cors-middleware" + identifier = "middleware-cors" parent = "recipes" weight = 3 +++ diff --git a/website/content/recipes/http2.md b/website/content/recipes/http2.md index c084c70f..8b731223 100644 --- a/website/content/recipes/http2.md +++ b/website/content/recipes/http2.md @@ -7,12 +7,11 @@ description = "HTTP/2 example for Echo" weight = 3 +++ -## What is HTTP/2? - HTTP/2 (originally named HTTP/2.0) is the second major version of the HTTP network -protocol used by the World Wide Web +protocol used by the World Wide Web. HTTP/2 improves speed and provides better user +experience. -### Features +### Key Features - Binary, instead of textual. - Fully multiplexed, instead of ordered and blocking, can therefore use just one TCP connection. diff --git a/website/content/recipes/jwt.md b/website/content/recipes/jwt.md index e8728468..053ab8e9 100644 --- a/website/content/recipes/jwt.md +++ b/website/content/recipes/jwt.md @@ -3,7 +3,7 @@ title = "JWT Example" description = "JWT example for Echo" [menu.main] name = "JWT" - identifier = "jwt-recipe" + identifier = "recipe-jwt" parent = "recipes" weight = 11 +++ diff --git a/website/data/index.toml b/website/data/index.toml index 0fd13881..3b6798fd 100644 --- a/website/data/index.toml +++ b/website/data/index.toml @@ -15,6 +15,10 @@ description = "High performance, extensible, minimalist Go web framework" icon = "license" title = "Automatic TLS" text = "Automatically install TLS certificates from Let's Encrypt." +[[features]] + icon = "speed_fast" + title = "HTTP/2" + text = "HTTP/2 support improves speed and provides better user experience." [[features]] icon = "funnel" title = "Middleware" diff --git a/website/layouts/index.html b/website/layouts/index.html index d1868bd9..c97ccf44 100644 --- a/website/layouts/index.html +++ b/website/layouts/index.html @@ -9,8 +9,8 @@
-

{{ .Site.Data.index.heading }}

-

{{ .Site.Data.index.description }}

+

{{ .Site.Data.index.heading }}

+

{{ .Site.Data.index.description }}

Echo

diff --git a/website/static/styles/main.css b/website/static/styles/main.css index 8b137891..e69de29b 100644 --- a/website/static/styles/main.css +++ b/website/static/styles/main.css @@ -1 +0,0 @@ -