diff --git a/website/content/cookbook.md b/website/content/cookbook.md index c42c0a78..68bc4c43 100644 --- a/website/content/cookbook.md +++ b/website/content/cookbook.md @@ -5,7 +5,7 @@ type = "cookbook" [menu.main] name = "Cookbook" pre = "" - weight = 2 + weight = 3 identifier = "cookbook" url = "/cookbook" +++ diff --git a/website/content/cookbook/auto-tls.md b/website/content/cookbook/auto-tls.md index 792d6637..476831fd 100644 --- a/website/content/cookbook/auto-tls.md +++ b/website/content/cookbook/auto-tls.md @@ -4,7 +4,6 @@ description = "Automatic TLS certificates from Let's Encrypt example for Echo" [menu.main] name = "Auto TLS" parent = "cookbook" - weight = 2 +++ This example shows how to obtain TLS certificates for a domain automatically from diff --git a/website/content/cookbook/cors.md b/website/content/cookbook/cors.md index dc661367..29d28ca2 100644 --- a/website/content/cookbook/cors.md +++ b/website/content/cookbook/cors.md @@ -5,7 +5,6 @@ description = "CORS example for Echo" name = "CORS" identifier = "middleware-cors" parent = "cookbook" - weight = 3 +++ ## Server diff --git a/website/content/cookbook/crud.md b/website/content/cookbook/crud.md index ff5bc6c2..bdd5fe51 100644 --- a/website/content/cookbook/crud.md +++ b/website/content/cookbook/crud.md @@ -4,7 +4,6 @@ description = "CRUD (Create, read, update and delete) example for Echo" [menu.main] name = "CRUD" parent = "cookbook" - weight = 2 +++ ## Server diff --git a/website/content/cookbook/embed-resources.md b/website/content/cookbook/embed-resources.md index 937e9d69..beb29f8c 100644 --- a/website/content/cookbook/embed-resources.md +++ b/website/content/cookbook/embed-resources.md @@ -4,7 +4,6 @@ description = "Embed resources example for Echo" [menu.main] name = "Embed Resources" parent = "cookbook" - weight = 14 +++ ## With go.rice diff --git a/website/content/cookbook/file-upload.md b/website/content/cookbook/file-upload.md index c75131fe..c62cec96 100644 --- a/website/content/cookbook/file-upload.md +++ b/website/content/cookbook/file-upload.md @@ -4,7 +4,6 @@ description = "File upload example for Echo" [menu.main] name = "File Upload" parent = "cookbook" - weight = 7 +++ ## How to upload single file with fields? diff --git a/website/content/cookbook/google-app-engine.md b/website/content/cookbook/google-app-engine.md index f3061609..6be185e5 100644 --- a/website/content/cookbook/google-app-engine.md +++ b/website/content/cookbook/google-app-engine.md @@ -4,7 +4,6 @@ description = "Google App Engine example for Echo" [menu.main] name = "Google App Engine" parent = "cookbook" - weight = 12 +++ Google App Engine (GAE) provides a range of hosting options from pure PaaS (App Engine Classic) diff --git a/website/content/cookbook/graceful-shutdown.md b/website/content/cookbook/graceful-shutdown.md index 16fbdbf2..29cf31ad 100644 --- a/website/content/cookbook/graceful-shutdown.md +++ b/website/content/cookbook/graceful-shutdown.md @@ -4,7 +4,6 @@ description = "Graceful shutdown example for Echo" [menu.main] name = "Graceful Shutdown" parent = "cookbook" - weight = 13 +++ ## Using [http.Server#Shutdown()](https://golang.org/pkg/net/http/#Server.Shutdown) diff --git a/website/content/cookbook/hello-world.md b/website/content/cookbook/hello-world.md index d6415d3a..db860755 100644 --- a/website/content/cookbook/hello-world.md +++ b/website/content/cookbook/hello-world.md @@ -4,7 +4,6 @@ description = "Hello world example for Echo" [menu.main] name = "Hello World" parent = "cookbook" - weight = 1 +++ ## Server diff --git a/website/content/cookbook/http2.md b/website/content/cookbook/http2.md index 4eb52afd..733a9b83 100644 --- a/website/content/cookbook/http2.md +++ b/website/content/cookbook/http2.md @@ -4,7 +4,6 @@ description = "HTTP/2 example for Echo" [menu.main] name = "HTTP/2" parent = "cookbook" - weight = 3 +++ HTTP/2 (originally named HTTP/2.0) is the second major version of the HTTP network diff --git a/website/content/cookbook/jsonp.md b/website/content/cookbook/jsonp.md index 1bfa6e6e..cdc47fb8 100644 --- a/website/content/cookbook/jsonp.md +++ b/website/content/cookbook/jsonp.md @@ -4,7 +4,6 @@ description = "JSONP example for Echo" [menu.main] name = "JSONP" parent = "cookbook" - weight = 6 +++ JSONP is a method that allows cross-domain server calls. You can read more about it at the JSON versus JSONP Tutorial. diff --git a/website/content/cookbook/jwt.md b/website/content/cookbook/jwt.md index 93e5f345..f1634fc4 100644 --- a/website/content/cookbook/jwt.md +++ b/website/content/cookbook/jwt.md @@ -5,7 +5,6 @@ description = "JWT example for Echo" name = "JWT" identifier = "example-jwt" parent = "cookbook" - weight = 11 +++ - JWT authentication using HS256 algorithm. diff --git a/website/content/cookbook/middleware.md b/website/content/cookbook/middleware.md index d732398f..50e231ee 100644 --- a/website/content/cookbook/middleware.md +++ b/website/content/cookbook/middleware.md @@ -4,7 +4,6 @@ description = "Middleware example for Echo" [menu.main] name = "Middleware" parent = "cookbook" - weight = 3 +++ ## How to write a custom middleware? diff --git a/website/content/cookbook/streaming-response.md b/website/content/cookbook/streaming-response.md index e6e912e2..1c294576 100644 --- a/website/content/cookbook/streaming-response.md +++ b/website/content/cookbook/streaming-response.md @@ -4,7 +4,6 @@ description = "Streaming response example for Echo" [menu.main] name = "Streaming Response" parent = "cookbook" - weight = 3 +++ - Send data as it is produced diff --git a/website/content/cookbook/subdomains.md b/website/content/cookbook/subdomains.md index 82c606ab..c6c5a4ea 100644 --- a/website/content/cookbook/subdomains.md +++ b/website/content/cookbook/subdomains.md @@ -4,7 +4,6 @@ description = "Subdomains example for Echo" [menu.main] name = "Subdomains" parent = "cookbook" - weight = 10 +++ `server.go` diff --git a/website/content/cookbook/twitter.md b/website/content/cookbook/twitter.md index 4f9bb194..bc3ae226 100644 --- a/website/content/cookbook/twitter.md +++ b/website/content/cookbook/twitter.md @@ -4,7 +4,6 @@ description = "Twitter Like API example for Echo" [menu.main] name = "Twitter" parent = "cookbook" - weight = 2 +++ This example shows how to create a Twitter like REST API using MongoDB (Database), diff --git a/website/content/cookbook/websocket.md b/website/content/cookbook/websocket.md index b194574a..02c23394 100644 --- a/website/content/cookbook/websocket.md +++ b/website/content/cookbook/websocket.md @@ -4,7 +4,6 @@ description = "WebSocket example for Echo" [menu.main] name = "WebSocket" parent = "cookbook" - weight = 5 +++ ## Using `net` WebSocket diff --git a/website/content/guide/context.md b/website/content/guide/context.md index e759700f..61bafee5 100644 --- a/website/content/guide/context.md +++ b/website/content/guide/context.md @@ -4,7 +4,6 @@ description = "Context in Echo" [menu.main] name = "Context" parent = "guide" - weight = 5 +++ `echo.Context` represents the context of the current HTTP request. It holds request and diff --git a/website/content/guide/cookies.md b/website/content/guide/cookies.md index bf36708f..851aaf1b 100644 --- a/website/content/guide/cookies.md +++ b/website/content/guide/cookies.md @@ -4,7 +4,6 @@ description = "Handling cookie in Echo" [menu.main] name = "Cookies" parent = "guide" - weight = 6 +++ Cookie is a small piece of data sent from a website and stored in the user's web diff --git a/website/content/guide/customization.md b/website/content/guide/customization.md index 22065fd2..0b8cdcd5 100644 --- a/website/content/guide/customization.md +++ b/website/content/guide/customization.md @@ -4,7 +4,6 @@ description = "Customizing Echo" [menu.main] name = "Customization" parent = "guide" - weight = 3 +++ ## Debug diff --git a/website/content/guide/error-handling.md b/website/content/guide/error-handling.md index 925c50b6..3d878778 100644 --- a/website/content/guide/error-handling.md +++ b/website/content/guide/error-handling.md @@ -4,7 +4,6 @@ description = "Error handling in Echo" [menu.main] name = "Error Handling" parent = "guide" - weight = 8 +++ Echo advocates centralized HTTP error handling by returning error from middleware diff --git a/website/content/guide/faq.md b/website/content/guide/faq.md index c4bee720..89403cc4 100644 --- a/website/content/guide/faq.md +++ b/website/content/guide/faq.md @@ -4,7 +4,6 @@ description = "Frequently asked questions in Echo" [menu.main] name = "FAQ" parent = "guide" - weight = 20 +++ Q: How to retrieve `*http.Request` and `http.ResponseWriter` from `echo.Context`? diff --git a/website/content/guide/installation.md b/website/content/guide/installation.md index b05a6dda..0ddb5a40 100644 --- a/website/content/guide/installation.md +++ b/website/content/guide/installation.md @@ -4,7 +4,6 @@ description = "Installing Echo" [menu.main] name = "Installation" parent = "guide" - weight = 1 +++ ## Prerequisites diff --git a/website/content/guide/migration.md b/website/content/guide/migration.md index 37dffb51..ed1f17ab 100644 --- a/website/content/guide/migration.md +++ b/website/content/guide/migration.md @@ -4,7 +4,6 @@ description = "Migration" [menu.main] name = "Migration" parent = "guide" - weight = 2 +++ ## Change Log diff --git a/website/content/guide/request.md b/website/content/guide/request.md index 3fa38b80..e5d7d6ee 100644 --- a/website/content/guide/request.md +++ b/website/content/guide/request.md @@ -4,7 +4,6 @@ description = "Handling HTTP request in Echo" [menu.main] name = "Request" parent = "guide" - weight = 6 +++ ## Bind Data diff --git a/website/content/guide/response.md b/website/content/guide/response.md index 4a84d447..d210f258 100644 --- a/website/content/guide/response.md +++ b/website/content/guide/response.md @@ -4,7 +4,6 @@ description = "Sending HTTP response in Echo" [menu.main] name = "Response" parent = "guide" - weight = 6 +++ ## Send String diff --git a/website/content/guide/routing.md b/website/content/guide/routing.md index 490decf0..fd8b2f69 100644 --- a/website/content/guide/routing.md +++ b/website/content/guide/routing.md @@ -4,7 +4,6 @@ description = "Routing HTTP request in Echo" [menu.main] name = "Routing" parent = "guide" - weight = 4 +++ Echo's router is based on [radix tree](http://en.wikipedia.org/wiki/Radix_tree) makings diff --git a/website/content/guide/static-files.md b/website/content/guide/static-files.md index 66c2dc48..c5c88e69 100644 --- a/website/content/guide/static-files.md +++ b/website/content/guide/static-files.md @@ -4,7 +4,6 @@ description = "Serving static files in Echo" [menu.main] name = "Static Files" parent = "guide" - weight = 3 +++ Images, JavaScript, CSS, PDF, Fonts and so on... diff --git a/website/content/guide/templates.md b/website/content/guide/templates.md index ffd7828b..e63d4970 100644 --- a/website/content/guide/templates.md +++ b/website/content/guide/templates.md @@ -4,7 +4,6 @@ description = "How to use templates in Echo" [menu.main] name = "Templates" parent = "guide" - weight = 3 +++ ## Template Rendering diff --git a/website/content/guide/testing.md b/website/content/guide/testing.md index 7c0f2115..39de2a20 100644 --- a/website/content/guide/testing.md +++ b/website/content/guide/testing.md @@ -4,7 +4,6 @@ description = "Testing handler and middleware in Echo" [menu.main] name = "Testing" parent = "guide" - weight = 9 +++ ## Testing Handler diff --git a/website/content/middleware/basic-auth.md b/website/content/middleware/basic-auth.md index 265b79a3..7d1df992 100644 --- a/website/content/middleware/basic-auth.md +++ b/website/content/middleware/basic-auth.md @@ -4,7 +4,6 @@ description = "Basic auth middleware for Echo" [menu.main] name = "Basic Auth" parent = "middleware" - weight = 5 +++ Basic auth middleware provides an HTTP basic authentication. diff --git a/website/content/middleware/body-limit.md b/website/content/middleware/body-limit.md index a1f52537..28e02774 100644 --- a/website/content/middleware/body-limit.md +++ b/website/content/middleware/body-limit.md @@ -4,7 +4,6 @@ description = "Body limit middleware for Echo" [menu.main] name = "Body Limit" parent = "middleware" - weight = 5 +++ Body limit middleware sets the maximum allowed size for a request body, if the diff --git a/website/content/middleware/cors.md b/website/content/middleware/cors.md index 432a9cee..ddf3ffbf 100644 --- a/website/content/middleware/cors.md +++ b/website/content/middleware/cors.md @@ -4,7 +4,6 @@ description = "CORS middleware for Echo" [menu.main] name = "CORS" parent = "middleware" - weight = 5 +++ CORS middleware implements [CORS](http://www.w3.org/TR/cors) specification. diff --git a/website/content/middleware/csrf.md b/website/content/middleware/csrf.md index 43aeba94..e8e66b71 100644 --- a/website/content/middleware/csrf.md +++ b/website/content/middleware/csrf.md @@ -4,7 +4,6 @@ description = "CSRF middleware for Echo" [menu.main] name = "CSRF" parent = "middleware" - weight = 5 +++ Cross-site request forgery, also known as one-click attack or session riding and diff --git a/website/content/middleware/gzip.md b/website/content/middleware/gzip.md index 43a0d3e9..8216f446 100644 --- a/website/content/middleware/gzip.md +++ b/website/content/middleware/gzip.md @@ -4,7 +4,6 @@ description = "Gzip middleware for Echo" [menu.main] name = "Gzip" parent = "middleware" - weight = 5 +++ Gzip middleware compresses HTTP response using gzip compression scheme. diff --git a/website/content/middleware/jwt.md b/website/content/middleware/jwt.md index f347e44d..ddc65d76 100644 --- a/website/content/middleware/jwt.md +++ b/website/content/middleware/jwt.md @@ -4,7 +4,6 @@ description = "JWT middleware for Echo" [menu.main] name = "JWT" parent = "middleware" - weight = 5 +++ JWT provides a JSON Web Token (JWT) authentication middleware. diff --git a/website/content/middleware/key-auth.md b/website/content/middleware/key-auth.md index b30d43c1..a6a4e15f 100644 --- a/website/content/middleware/key-auth.md +++ b/website/content/middleware/key-auth.md @@ -4,7 +4,6 @@ description = "Key auth middleware for Echo" [menu.main] name = "Key Auth" parent = "middleware" - weight = 5 +++ Key auth middleware provides a key based authentication. diff --git a/website/content/middleware/logger.md b/website/content/middleware/logger.md index 82c1a168..ec60382f 100644 --- a/website/content/middleware/logger.md +++ b/website/content/middleware/logger.md @@ -4,7 +4,6 @@ description = "Logger middleware for Echo" [menu.main] name = "Logger" parent = "middleware" - weight = 5 +++ Logger middleware logs the information about each HTTP request. @@ -84,7 +83,7 @@ LoggerConfig struct { ```go DefaultLoggerConfig = LoggerConfig{ Skipper: DefaultSkipper, - Format: `{"time":"${time_rfc3339_nano}","remote_ip":"${remote_ip}","host":"${host}",` + + Format: `{"time":"${time_rfc3339_nano}","id":"${id}","remote_ip":"${remote_ip}","host":"${host}",` + `"method":"${method}","uri":"${uri}","status":${status}, "latency":${latency},` + `"latency_human":"${latency_human}","bytes_in":${bytes_in},` + `"bytes_out":${bytes_out}}` + "\n", diff --git a/website/content/middleware/method-override.md b/website/content/middleware/method-override.md index dd6d6f5f..4eb7005a 100644 --- a/website/content/middleware/method-override.md +++ b/website/content/middleware/method-override.md @@ -4,7 +4,6 @@ description = "Method override middleware for Echo" [menu.main] name = "Method Override" parent = "middleware" - weight = 5 +++ Method override middleware checks for the overridden method from the request and diff --git a/website/content/middleware/recover.md b/website/content/middleware/recover.md index 862c3317..bb1845ae 100644 --- a/website/content/middleware/recover.md +++ b/website/content/middleware/recover.md @@ -4,7 +4,6 @@ description = "Recover middleware for Echo" [menu.main] name = "Recover" parent = "middleware" - weight = 5 +++ Recover middleware recovers from panics anywhere in the chain, prints stack trace diff --git a/website/content/middleware/redirect.md b/website/content/middleware/redirect.md index 31e99fd5..0c4d9200 100644 --- a/website/content/middleware/redirect.md +++ b/website/content/middleware/redirect.md @@ -4,7 +4,6 @@ description = "Redirect middleware for Echo" [menu.main] name = "Redirect" parent = "middleware" - weight = 5 +++ ## HTTPS Redirect diff --git a/website/content/middleware/request-id.md b/website/content/middleware/request-id.md new file mode 100644 index 00000000..4a9e562a --- /dev/null +++ b/website/content/middleware/request-id.md @@ -0,0 +1,48 @@ ++++ +title = "Request ID Middleware" +description = "Request ID middleware for Echo" +[menu.main] + name = "Request ID" + parent = "middleware" ++++ + +Request ID middleware generates a unique id for a request. + +*Usage* + +`e.Use(middleware.RequestID())` + +## Custom Configuration + +*Usage* + +```go +e.Use(middleware.RequestIDWithConfig(middleware.RequestIDConfig{ + Generator: func() string { + return customGenerator() + }, +})) +``` + +## Configuration + +```go +// RequestIDConfig defines the config for RequestID middleware. +RequestIDConfig struct { + // Skipper defines a function to skip middleware. + Skipper Skipper + + // Generator defines a function to generate an ID. + // Optional. Default value random.String(32). + Generator func() string +} +``` + +*Default Configuration* + +```go +DefaultRequestIDConfig = RequestIDConfig{ + Skipper: DefaultSkipper, + Generator: generator, +} +``` diff --git a/website/content/middleware/secure.md b/website/content/middleware/secure.md index 8ba67956..6d60a2ff 100644 --- a/website/content/middleware/secure.md +++ b/website/content/middleware/secure.md @@ -4,7 +4,6 @@ description = "Secure middleware for Echo" [menu.main] name = "Secure" parent = "middleware" - weight = 5 +++ Secure middleware provides protection against cross-site scripting (XSS) attack, diff --git a/website/content/middleware/static.md b/website/content/middleware/static.md index 5d34121c..ac59a853 100644 --- a/website/content/middleware/static.md +++ b/website/content/middleware/static.md @@ -4,7 +4,6 @@ description = "Static middleware for Echo" [menu.main] name = "Static" parent = "middleware" - weight = 5 +++ Static middleware can be used to serve static files from the provided root directory. diff --git a/website/content/middleware/trailing-slash.md b/website/content/middleware/trailing-slash.md index 2823f0f6..c504f3c5 100644 --- a/website/content/middleware/trailing-slash.md +++ b/website/content/middleware/trailing-slash.md @@ -4,7 +4,6 @@ description = "Trailing slash middleware for Echo" [menu.main] name = "Trailing Slash" parent = "middleware" - weight = 5 +++ ## Add Trailing Slash