1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-06 08:59:21 +02:00

Closes #235, Closes #203

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2015-11-12 20:23:14 -08:00
parent e48ebd3421
commit 56954bc0b6
5 changed files with 60 additions and 19 deletions

View File

@@ -6,6 +6,22 @@ menu:
weight: 5
---
### Handler path
`Context#Path()` returns the registered path for a handler, it can be used in the middleware for logging purpose.
*Example*
```go
e.Use(func(c *echo.Context) error {
log.Println(c.Path()) // Prints `/users/:name`
return nil
})
e.Get("/users/:name", func(c *echo.Context) error) {
return c.String(http.StatusOK, name)
})
```
### Path parameter
Path parameter can be retrieved either by name `Context.Param(name string) string`