Skip to content

Commit b4dd5d3

Browse files
Update docs/api/app.md
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent d2749c9 commit b4dd5d3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/api/app.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -585,13 +585,13 @@ func (app *App) RebuildTree() *App
585585
**NOTE**: This method should be used in the most careful way possible, since it's not currently possible to make it thread-safe (it would add a big performance overhead to do so) and calling it is very performance-intensive, so it's recommended to be used only in development mode and never concurrently. Here's an example of defining routes dynamically:
586586

587587
```go
588-
app.Get("/define", func(c Ctx) error {
589-
app.Get("/dynamically-defined", func(c Ctx) error {
590-
return c.SendStatus(http.StatusOK)
591-
})
588+
app.Get("/define", func(c Ctx) error { // Define a new route dynamically
589+
app.Get("/dynamically-defined", func(c Ctx) error { // Adding a dynamically defined route
590+
return c.SendStatus(http.StatusOK)
591+
})
592592

593-
app.RebuildTree()
593+
app.RebuildTree() // Rebuild the route tree to register the new route
594594

595-
return c.SendStatus(http.StatusOK)
595+
return c.SendStatus(http.StatusOK)
596596
})
597597
```

0 commit comments

Comments
 (0)