mirror of
https://github.com/labstack/echo.git
synced 2025-01-01 22:09:21 +02:00
Updated docs
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
4b4a09fd31
commit
0ae8ceb3eb
@ -5,7 +5,7 @@ type = "cookbook"
|
||||
[menu.main]
|
||||
name = "Cookbook"
|
||||
pre = "<i class='fa fa-code'></i>"
|
||||
weight = 2
|
||||
weight = 3
|
||||
identifier = "cookbook"
|
||||
url = "/cookbook"
|
||||
+++
|
||||
|
@ -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
|
||||
|
@ -5,7 +5,6 @@ description = "CORS example for Echo"
|
||||
name = "CORS"
|
||||
identifier = "middleware-cors"
|
||||
parent = "cookbook"
|
||||
weight = 3
|
||||
+++
|
||||
|
||||
## Server
|
||||
|
@ -4,7 +4,6 @@ description = "CRUD (Create, read, update and delete) example for Echo"
|
||||
[menu.main]
|
||||
name = "CRUD"
|
||||
parent = "cookbook"
|
||||
weight = 2
|
||||
+++
|
||||
|
||||
## Server
|
||||
|
@ -4,7 +4,6 @@ description = "Embed resources example for Echo"
|
||||
[menu.main]
|
||||
name = "Embed Resources"
|
||||
parent = "cookbook"
|
||||
weight = 14
|
||||
+++
|
||||
|
||||
## With go.rice
|
||||
|
@ -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?
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -4,7 +4,6 @@ description = "Hello world example for Echo"
|
||||
[menu.main]
|
||||
name = "Hello World"
|
||||
parent = "cookbook"
|
||||
weight = 1
|
||||
+++
|
||||
|
||||
## Server
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -5,7 +5,6 @@ description = "JWT example for Echo"
|
||||
name = "JWT"
|
||||
identifier = "example-jwt"
|
||||
parent = "cookbook"
|
||||
weight = 11
|
||||
+++
|
||||
|
||||
- JWT authentication using HS256 algorithm.
|
||||
|
@ -4,7 +4,6 @@ description = "Middleware example for Echo"
|
||||
[menu.main]
|
||||
name = "Middleware"
|
||||
parent = "cookbook"
|
||||
weight = 3
|
||||
+++
|
||||
|
||||
## How to write a custom middleware?
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,6 @@ description = "Subdomains example for Echo"
|
||||
[menu.main]
|
||||
name = "Subdomains"
|
||||
parent = "cookbook"
|
||||
weight = 10
|
||||
+++
|
||||
|
||||
`server.go`
|
||||
|
@ -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),
|
||||
|
@ -4,7 +4,6 @@ description = "WebSocket example for Echo"
|
||||
[menu.main]
|
||||
name = "WebSocket"
|
||||
parent = "cookbook"
|
||||
weight = 5
|
||||
+++
|
||||
|
||||
## Using `net` WebSocket
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,6 @@ description = "Customizing Echo"
|
||||
[menu.main]
|
||||
name = "Customization"
|
||||
parent = "guide"
|
||||
weight = 3
|
||||
+++
|
||||
|
||||
## Debug
|
||||
|
@ -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
|
||||
|
@ -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`?
|
||||
|
@ -4,7 +4,6 @@ description = "Installing Echo"
|
||||
[menu.main]
|
||||
name = "Installation"
|
||||
parent = "guide"
|
||||
weight = 1
|
||||
+++
|
||||
|
||||
## Prerequisites
|
||||
|
@ -4,7 +4,6 @@ description = "Migration"
|
||||
[menu.main]
|
||||
name = "Migration"
|
||||
parent = "guide"
|
||||
weight = 2
|
||||
+++
|
||||
|
||||
## Change Log
|
||||
|
@ -4,7 +4,6 @@ description = "Handling HTTP request in Echo"
|
||||
[menu.main]
|
||||
name = "Request"
|
||||
parent = "guide"
|
||||
weight = 6
|
||||
+++
|
||||
|
||||
## Bind Data
|
||||
|
@ -4,7 +4,6 @@ description = "Sending HTTP response in Echo"
|
||||
[menu.main]
|
||||
name = "Response"
|
||||
parent = "guide"
|
||||
weight = 6
|
||||
+++
|
||||
|
||||
## Send String
|
||||
|
@ -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
|
||||
|
@ -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...
|
||||
|
@ -4,7 +4,6 @@ description = "How to use templates in Echo"
|
||||
[menu.main]
|
||||
name = "Templates"
|
||||
parent = "guide"
|
||||
weight = 3
|
||||
+++
|
||||
|
||||
## Template Rendering
|
||||
|
@ -4,7 +4,6 @@ description = "Testing handler and middleware in Echo"
|
||||
[menu.main]
|
||||
name = "Testing"
|
||||
parent = "guide"
|
||||
weight = 9
|
||||
+++
|
||||
|
||||
## Testing Handler
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,6 @@ description = "Redirect middleware for Echo"
|
||||
[menu.main]
|
||||
name = "Redirect"
|
||||
parent = "middleware"
|
||||
weight = 5
|
||||
+++
|
||||
|
||||
## HTTPS Redirect
|
||||
|
48
website/content/middleware/request-id.md
Normal file
48
website/content/middleware/request-id.md
Normal file
@ -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,
|
||||
}
|
||||
```
|
@ -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,
|
||||
|
@ -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.
|
||||
|
@ -4,7 +4,6 @@ description = "Trailing slash middleware for Echo"
|
||||
[menu.main]
|
||||
name = "Trailing Slash"
|
||||
parent = "middleware"
|
||||
weight = 5
|
||||
+++
|
||||
|
||||
## Add Trailing Slash
|
||||
|
Loading…
Reference in New Issue
Block a user