Skip to content

Commit 85b2ace

Browse files
Add docs from gofiber/fiber@542f4eb
1 parent 920df81 commit 85b2ace

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

docs/core/api/app.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ Returns `b` unchanged when [`Immutable`](./fiber.md#immutable) is disabled or `b
2525
func (app *App) GetBytes(b []byte) []byte
2626
```
2727

28+
### ReloadViews
29+
30+
Reloads the configured view engine on demand by calling its `Load` method. Use this helper in development workflows (e.g., file watchers or debug-only routes) to pick up template changes without restarting the server. Returns an error if no view engine is configured or reloading fails.
31+
32+
```go title="Signature"
33+
func (app *App) ReloadViews() error
34+
```
35+
36+
```go title="Example"
37+
app := fiber.New(fiber.Config{Views: engine})
38+
39+
app.Get("/dev/reload", func(c fiber.Ctx) error {
40+
if err := app.ReloadViews(); err != nil {
41+
return err
42+
}
43+
return c.SendString("Templates reloaded")
44+
})
45+
```
46+
2847
## Routing
2948

3049
import RoutingHandler from './../partials/routing/handler.md';

docs/core/whats_new.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ We have made several changes to the Fiber app, including:
8484
- **State**: Provides a global state for the application, which can be used to store and retrieve data across the application. Check out the [State](./api/state) method for further details.
8585
- **NewErrorf**: Allows variadic parameters when creating formatted errors.
8686
- **GetBytes / GetString**: Helpers that detach values only when `Immutable` is enabled and the data still references request or response buffers. Access via `c.App().GetString` and `c.App().GetBytes`.
87+
- **ReloadViews**: Lets you re-run the configured view engine's `Load()` logic at runtime, including guard rails for missing or nil view engines so development hot-reload hooks can refresh templates safely.
8788

8889
#### Custom Route Constraints
8990

0 commit comments

Comments
 (0)