Skip to content

Commit

Permalink
Add docs for GetRoute method.
Browse files Browse the repository at this point in the history
  • Loading branch information
efectn committed Dec 18, 2021
1 parent a35df97 commit 2c2a1cb
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions api/app.md
Expand Up @@ -421,6 +421,47 @@ func main() {
```
{% endcode %}

## GetRoute

This method gets the route by name.

{% code title="Signature" %}
```go
func (app *App) GetRoute(name string) Route
```
{% endcode %}

{% code title="Example" %}
```go
var handler = func(c *fiber.Ctx) error { return nil }
func main() {
app := fiber.New()
app.Get("/", handler).Name("index")
data, _ := json.MarshalIndent(app.GetRoute("index"), "", " ")
fmt.Print(string(data))
app.Listen(":3000")
}
```
{% endcode %}

{% code title="Result" %}
```javascript
{
"method": "GET",
"name": "index",
"path": "/",
"params": null
}
```
{% endcode %}


## Config

Config returns the app config as value \( read-only \).
Expand Down

0 comments on commit 2c2a1cb

Please sign in to comment.