Skip to content

Commit f8f34f6

Browse files
authored
Merge pull request #4045 from gofiber/improve-documentation-in-whats_new.md
2 parents 1b0f627 + 951bbf6 commit f8f34f6

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

docs/api/hooks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (h *Hooks) OnGroupName(handler ...OnGroupNameHandler)
128128

129129
## OnListen
130130

131-
Runs when the app starts listening via `Listen`, `ListenTLS`, or `Listener`.
131+
Runs when the app starts listening via `Listen` or `Listener`.
132132

133133
```go title="Signature"
134134
func (h *Hooks) OnListen(handler ...OnListenHandler)
@@ -310,7 +310,7 @@ func main() {
310310
return nil
311311
})
312312

313-
app.Mount("/sub", subApp)
313+
app.Use("/sub", subApp)
314314
}
315315

316316
func testSimpleHandler(c fiber.Ctx) error {

docs/extra/internal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ Middleware are executed in the order they are registered. This sequential design
180180

181181
Fiber allows mounting sub‑applications (or sub‑routers) under specific path prefixes. This enables modular design of large APIs. The mounting process works as follows:
182182

183-
1. Defining a Mount Point: A parent application calls `App.Mount()` or a Group calls its own `mount()` method.
183+
1. Defining a Mount Point: A parent application (or group) calls `Use` with a sub-app, which triggers the internal mount path logic.
184184
2. Merging Mount Fields: The sub‑app’s mount fields are updated with the prefix of the parent, and its routes are integrated into the parent’s routing structure.
185185
3. Processing Sub‑App Routes: During startup, the parent app collects routes from mounted sub‑apps and builds a unified route tree.
186186

docs/whats_new.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ Here's a quick overview of the changes in Fiber `v3`:
5959
- [🔌 Addons](#-addons)
6060
- [📋 Migration guide](#-migration-guide)
6161

62-
## Drop for old Go versions
62+
## Dropping support for old Go versions
6363

64-
Fiber `v3` drops support for Go versions below `1.25`. We recommend upgrading to Go `1.25` or higher to use Fiber `v3`.
64+
Fiber `v3` requires Go `1.25` or later. Update your toolchain to `1.25+` before upgrading so the module `go` directive and standard library features align with the new minimum version.
6565

6666
## 🚀 App
6767

@@ -248,13 +248,13 @@ app.Shutdown() // Never reached
248248

249249
We have made several changes to the Fiber listen, including:
250250

251-
- Removed `OnShutdownError` and `OnShutdownSuccess` from `ListenerConfig` in favor of using `OnPostShutdown` hook which receives the shutdown error
251+
- Removed `OnShutdownError` and `OnShutdownSuccess` from `ListenConfig` in favor of using the `OnPostShutdown` hook, which receives the shutdown error
252252

253253
```go
254254
app := fiber.New()
255255

256-
// Before - using ListenerConfig callbacks
257-
app.Listen(":3000", fiber.ListenerConfig{
256+
// Before - using ListenConfig callbacks
257+
app.Listen(":3000", fiber.ListenConfig{
258258
OnShutdownError: func(err error) {
259259
log.Printf("Shutdown error: %v", err)
260260
},
@@ -293,7 +293,7 @@ app.Listen("app.sock")
293293

294294
// v3 - Fiber does it for you
295295
app := fiber.New()
296-
app.Listen("app.sock", fiber.ListenerConfig{
296+
app.Listen("app.sock", fiber.ListenConfig{
297297
ListenerNetwork: fiber.NetworkUnix,
298298
UnixSocketFileMode: 0770,
299299
})
@@ -1380,8 +1380,8 @@ The `ExcludeVars` field has been removed from the EnvVar middleware configuratio
13801380

13811381
### Filesystem
13821382

1383-
We've decided to remove filesystem middleware to clear up the confusion between static and filesystem middleware.
1384-
Now, static middleware can do everything that filesystem middleware and static do. You can check out [static middleware](./middleware/static.md) or [migration guide](#-migration-guide) to see what has been changed.
1383+
The filesystem middleware was removed to reduce confusion with the static middleware.
1384+
The static middleware now covers the functionality of both. Review the [static middleware](./middleware/static.md) docs or the [migration guide](#-migration-guide) for the updated usage.
13851385

13861386
### Healthcheck
13871387

@@ -1397,7 +1397,7 @@ New `Challenge`, `Error`, `ErrorDescription`, `ErrorURI`, and `Scope` fields all
13971397

13981398
### Logger
13991399

1400-
New helper function called `LoggerToWriter` has been added to the logger middleware. This function allows you to use 3rd party loggers such as `logrus` or `zap` with the Fiber logger middleware without any extra afford. For example, you can use `zap` with Fiber logger middleware like this:
1400+
New helper function called `LoggerToWriter` has been added to the logger middleware. This function allows you to use 3rd party loggers such as `logrus` or `zap` with the Fiber logger middleware without an extra adapter. For example, you can use `zap` with Fiber logger middleware like this:
14011401

14021402
Custom logger integrations should update any `LoggerFunc` implementations to the new signature that receives a pointer to the middleware config: `func(c fiber.Ctx, data *logger.Data, cfg *logger.Config) error`.
14031403

@@ -1794,8 +1794,9 @@ app.OnShutdown(func() {
17941794

17951795
```go
17961796
// After
1797-
app.OnPreShutdown(func() {
1797+
app.Hooks().OnPreShutdown(func() error {
17981798
// Code to run before shutdown
1799+
return nil
17991800
})
18001801
```
18011802

@@ -1804,7 +1805,8 @@ app.OnPreShutdown(func() {
18041805
The `Listen` helpers (`ListenTLS`, `ListenMutualTLS`, etc.) were removed. Use
18051806
`app.Listen()` with `fiber.ListenConfig` and a `tls.Config` when TLS is required.
18061807
Options such as `ListenerNetwork` and `UnixSocketFileMode` are now configured via
1807-
this struct.
1808+
this struct. Prefer `TLSConfig` when you need full control, or use `CertFile` and
1809+
`CertKeyFile` for quick TLS setup.
18081810

18091811
```go
18101812
// Before
@@ -1814,8 +1816,8 @@ app.ListenTLS(":3000", "cert.pem", "key.pem")
18141816
```go
18151817
// After
18161818
app.Listen(":3000", fiber.ListenConfig{
1817-
CertFile: "./cert.pem",
1818-
CertKeyFile: "./cert.key",
1819+
CertFile: "./cert.pem",
1820+
CertKeyFile: "./key.pem",
18191821
})
18201822
```
18211823

hooks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func (h *Hooks) OnGroupName(handler ...OnGroupNameHandler) {
272272
h.app.mutex.Unlock()
273273
}
274274

275-
// OnListen is a hook to execute user functions on Listen, ListenTLS, Listener.
275+
// OnListen is a hook to execute user functions on Listen or Listener.
276276
func (h *Hooks) OnListen(handler ...OnListenHandler) {
277277
h.app.mutex.Lock()
278278
h.onListen = append(h.onListen, handler...)

0 commit comments

Comments
 (0)