diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml index 0452c7c5a4..84408f69f2 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report.yaml @@ -10,15 +10,15 @@ body: value: | ### Notice **This repository is not related to external or third-part Fiber modules. If you have a problem with them, open an issue under their repos. If you think the problem is related to Fiber, open the issue here.** - - Dont't forget you can ask your questions on our [Discord server](https://gofiber.io/discord). - - If you think Fiber doesn't have a nice feature that you think, open the issue with **✏️ Feature Request** template. + - Don't forget you can ask your questions in our [Discord server](https://gofiber.io/discord). + - If you have a suggestion for a Fiber feature you would like to see, open the issue with the **✏️ Feature Request** template. - Write your issue with clear and understandable English. - type: textarea id: description attributes: label: "Bug Description" description: "A clear and detailed description of what the bug is." - placeholder: "Explain your problem as clear and detailed." + placeholder: "Explain your problem clearly and in detail." validations: required: true - type: textarea @@ -39,7 +39,7 @@ body: id: expected-behavior attributes: label: Expected Behavior - description: "A clear and detailed description of what you think should happens." + description: "A clear and detailed description of what you think should happen." placeholder: "Tell us what Fiber should normally do." validations: required: true @@ -56,7 +56,7 @@ body: attributes: label: "Code Snippet (optional)" description: "For some issues, we need to know some parts of your code." - placeholder: "Share a code you think related to the issue." + placeholder: "Share a code snippet that you think is related to the issue." render: go value: | package main diff --git a/.github/ISSUE_TEMPLATE/feature-request.yaml b/.github/ISSUE_TEMPLATE/feature-request.yaml index 83bbcafdc8..91a05fd6cc 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yaml +++ b/.github/ISSUE_TEMPLATE/feature-request.yaml @@ -9,15 +9,15 @@ body: attributes: value: | ### Notice - - Dont't forget you can ask your questions on our [Discord server](https://gofiber.io/discord). - - If you think this is just a bug, open the issue with **☢️ Bug Report** template. + - Don't forget you can ask your questions in our [Discord server](https://gofiber.io/discord). + - If you think this is just a bug, open the issue with the **☢️ Bug Report** template. - Write your issue with clear and understandable English. - type: textarea id: description attributes: label: "Feature Description" - description: "A clear and detailed description of the feature we need to do." - placeholder: "Explain your feature as clear and detailed." + description: "A clear and detailed description of the feature you would like to see added." + placeholder: "Explain your feature clearly, and in detail." validations: required: true - type: textarea @@ -31,7 +31,7 @@ body: attributes: label: "Code Snippet (optional)" description: "Code snippet may be really helpful to describe some features." - placeholder: "Share a code to explain the feature better." + placeholder: "Share a code snippet to explain the feature better." render: go value: | package main diff --git a/.github/ISSUE_TEMPLATE/question.yaml b/.github/ISSUE_TEMPLATE/question.yaml index 6e06c16788..d5df2a3d87 100644 --- a/.github/ISSUE_TEMPLATE/question.yaml +++ b/.github/ISSUE_TEMPLATE/question.yaml @@ -9,16 +9,16 @@ body: attributes: value: | ### Notice - - Dont't forget you can ask your questions on our [Discord server](https://gofiber.io/discord). - - If you think this is just a bug, open the issue with **☢️ Bug Report** template. - - If you think Fiber doesn't have a nice feature that you think, open the issue with **✏️ Feature Request** template. + - Don't forget you can ask your questions in our [Discord server](https://gofiber.io/discord). + - If you think this is just a bug, open the issue with the **☢️ Bug Report** template. + - If you have a suggestion for a Fiber feature you would like to see, open the issue with the **✏️ Feature Request** template. - Write your issue with clear and understandable English. - type: textarea id: description attributes: label: "Question Description" description: "A clear and detailed description of the question." - placeholder: "Explain your question as clear and detailed." + placeholder: "Explain your question clearly, and in detail." validations: required: true - type: textarea @@ -26,7 +26,7 @@ body: attributes: label: "Code Snippet (optional)" description: "Code snippet may be really helpful to describe some features." - placeholder: "Share a code to explain the feature better." + placeholder: "Share a code snippet to explain the feature better." render: go value: | package main diff --git a/.github/README.md b/.github/README.md index 1374d8c3f6..03c596440e 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,6 +1,9 @@
-
+
+
+
+
+
+
+
+ Fiber Go dili üçün ən sürətli HTTP mühərriki Fasthttp və Express kitabxanasına bənzər arxitektura üzərində qurulmuş bir web framework-dür. Sıfır yaddaş ayrılması (zero-memory allocation) və performans səbəbilə development prosesini sürətləndirmək və asanlaşdırmaq üçün tərtib edilmişdir.
+
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
Hello, World!
@@ -61,6 +64,9 @@
+
+
+
@@ -118,7 +124,7 @@ These tests are performed by [TechEmpower](https://www.techempower.com/benchmark
## ⚙️ Installation
-Make sure you have Go installed ([download](https://go.dev/dl/)). Version `1.16` or higher is required.
+Make sure you have Go installed ([download](https://go.dev/dl/)). Version `1.17` or higher is required.
Initialize your project by creating a folder and then running `go mod init github.com/your/repo` ([learn more](https://go.dev/blog/using-go-modules)) inside the folder. Then install Fiber with the [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) command:
@@ -128,12 +134,12 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 Features
-- Robust [routing](https://docs.gofiber.io/routing)
+- Robust [routing](https://docs.gofiber.io/guide/routing)
- Serve [static files](https://docs.gofiber.io/api/app#static)
- Extreme [performance](https://docs.gofiber.io/extra/benchmarks)
- [Low memory](https://docs.gofiber.io/extra/benchmarks) footprint
- [API endpoints](https://docs.gofiber.io/api/ctx)
-- [Middleware](https://docs.gofiber.io/middleware) & [Next](https://docs.gofiber.io/api/ctx#next) support
+- [Middleware](https://docs.gofiber.io/category/-middleware) & [Next](https://docs.gofiber.io/api/ctx#next) support
- [Rapid](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) server-side programming
- [Template engines](https://github.com/gofiber/template)
- [WebSocket support](https://github.com/gofiber/websocket)
@@ -151,7 +157,7 @@ Fiber is **inspired** by Express, the most popular web framework on the Internet
We **listen** to our users in [issues](https://github.com/gofiber/fiber/issues), Discord [channel](https://gofiber.io/discord) _and all over the Internet_ to create a **fast**, **flexible** and **friendly** Go web framework for **any** task, **deadline** and developer **skill**! Just like Express does in the JavaScript world.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.20.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.17 to 1.20.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 Examples
@@ -440,7 +446,7 @@ func main() {
### JSON Response
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -582,7 +588,7 @@ func main() {
app := fiber.New(fiber.Config{
EnableTrustedProxyCheck: true,
TrustedProxies: []string{"0.0.0.0", "1.1.1.1/30"}, // IP address or IP address range
- ProxyHeader: fiber.HeaderXForwardedFor},
+ ProxyHeader: fiber.HeaderXForwardedFor,
})
// ...
@@ -619,7 +625,12 @@ Here is a list of middleware that are included within the Fiber framework.
| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | Adds a requestid to every request. |
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler if a predicate is true. |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
+| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
## 🧬 External Middleware
@@ -627,12 +638,7 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
| Middleware | Description |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
@@ -694,7 +700,6 @@ Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_az.md b/.github/README_az.md
new file mode 100644
index 0000000000..f6486333eb
--- /dev/null
+++ b/.github/README_az.md
@@ -0,0 +1,710 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+📚 Daha çox misalllar
+
+### Baxış mühərriki (View Engine)
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Mühərriklər](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Fiber baxış mühərriki təyin edilmədikdə [html/template-in](https://pkg.go.dev/html/template/) default formasını alır.
+
+Əgər siz partial-ı və ya müxtəlif tipdə olan mühərrikləri istifadə etmək istəyirsinizsə, o zaman [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache), [pug](https://github.com/Joker/jade) və s. kimi misallara baxa bilərsiniz.
+
+Çoxsaylı baxış mühərriklərini dəstəkləyən [template](https://github.com/gofiber/template) package-ə göstərilən link vasitəsilə nəzərdən keçirə bilərsiniz.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // Baxış mühərrikini tətbiqi başlatzmadan əvvəl quraşdıra bilərsiniz:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // Və indi `./views/home.pug` template-i bu şəkildə çağıra bilərsiniz:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Route-ın zəncirlərdə qruplaşdırılması
+
+📖 [Group](https://docs.gofiber.io/api/app#group)
+
+```go
+func middleware(c *fiber.Ctx) error {
+ fmt.Println("Don't mind me!")
+ return c.Next()
+}
+
+func handler(c *fiber.Ctx) error {
+ return c.SendString(c.Path())
+}
+
+func main() {
+ app := fiber.New()
+
+ // Root API route
+ api := app.Group("/api", middleware) // /api
+
+ // API v1 routes
+ v1 := api.Group("/v1", middleware) // /api/v1
+ v1.Get("/list", handler) // /api/v1/list
+ v1.Get("/user", handler) // /api/v1/user
+
+ // API v2 routes
+ v2 := api.Group("/v2", middleware) // /api/v2
+ v2.Get("/list", handler) // /api/v2/list
+ v2.Get("/user", handler) // /api/v2/user
+
+ // ...
+}
+
+```
+
+### Middleware Logger
+
+📖 [Logger](https://docs.gofiber.io/api/middleware/logger)
+
+```go
+package main
+
+import (
+ "log"
+
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/logger"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Use(logger.New())
+
+ // ...
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Cross-Origin Resource Sharing (CORS)
+
+📖 [CORS](https://docs.gofiber.io/api/middleware/cors)
+
+```go
+import (
+ "log"
+
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/cors"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Use(cors.New())
+
+ // ...
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+"Origin" başlığında istənilən domeni keçməklə CORS-un yoxlanması:
+
+```bash
+curl -H "Origin: http://example.com" --verbose http://localhost:3000
+```
+
+### Custom 404 response
+
+📖 [HTTP Methods](https://docs.gofiber.io/api/ctx#status)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+
+ app.Get("/demo", func(c *fiber.Ctx) error {
+ return c.SendString("This is a demo!")
+ })
+
+ app.Post("/register", func(c *fiber.Ctx) error {
+ return c.SendString("Welcome!")
+ })
+
+ // Sonuncu middleware-in hər şeyə uyğunlaşdırılması
+ app.Use(func(c *fiber.Ctx) error {
+ return c.SendStatus(404)
+ // => 404 "Not Found"
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### JSON Response
+
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
+
+```go
+type User struct {
+ Name string `json:"name"`
+ Age int `json:"age"`
+}
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/user", func(c *fiber.Ctx) error {
+ return c.JSON(&User{"John", 20})
+ // => {"name":"John", "age":20}
+ })
+
+ app.Get("/json", func(c *fiber.Ctx) error {
+ return c.JSON(fiber.Map{
+ "success": true,
+ "message": "Hi John!",
+ })
+ // => {"success":true, "message":"Hi John!"}
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### WebSocket-in təkminləşdirilməsi (upgrade)
+
+📖 [Websocket](https://github.com/gofiber/websocket)
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/websocket"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/ws", websocket.New(func(c *websocket.Conn) {
+ for {
+ mt, msg, err := c.ReadMessage()
+ if err != nil {
+ log.Println("read:", err)
+ break
+ }
+ log.Printf("recv: %s", msg)
+ err = c.WriteMessage(mt, msg)
+ if err != nil {
+ log.Println("write:", err)
+ break
+ }
+ }
+ }))
+
+ log.Fatal(app.Listen(":3000"))
+ // ws://localhost:3000/ws
+}
+```
+
+### Server-Sent Events
+
+📖 [More Info](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/valyala/fasthttp"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/sse", func(c *fiber.Ctx) error {
+ c.Set("Content-Type", "text/event-stream")
+ c.Set("Cache-Control", "no-cache")
+ c.Set("Connection", "keep-alive")
+ c.Set("Transfer-Encoding", "chunked")
+
+ c.Context().SetBodyStreamWriter(fasthttp.StreamWriter(func(w *bufio.Writer) {
+ fmt.Println("WRITER")
+ var i int
+
+ for {
+ i++
+ msg := fmt.Sprintf("%d - the time is %v", i, time.Now())
+ fmt.Fprintf(w, "data: Message: %s\n\n", msg)
+ fmt.Println(msg)
+
+ w.Flush()
+ time.Sleep(5 * time.Second)
+ }
+ }))
+
+ return nil
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Middleware-in Bərpası
+
+📖 [Recover](https://docs.gofiber.io/api/middleware/recover)
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/recover"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Use(recover.New())
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ panic("normally this would crash your app")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
@@ -58,6 +63,9 @@
+
+
+
@@ -114,7 +122,7 @@ func main() {
## ⚙️ دامەزراندن
-دڵنیا بە لەوەی کە لەناو ئامێرەکەت Go دامەزراوە ([دای بگرە](https://go.dev/dl/)). دەبێت وەشانەکەشی `1.16` یان سەرووتر بێت.
+دڵنیا بە لەوەی کە لەناو ئامێرەکەت Go دامەزراوە ([دای بگرە](https://go.dev/dl/)). دەبێت وەشانەکەشی `1.17` یان سەرووتر بێت.
پڕۆژەکەت دەست پێ بکە بە دروستکردنی بوخچەیەک و کار پێ کردنی فەرمانی `go mod init github.com/your/repo` ([زیاتر](https://go.dev/blog/using-go-modules)) لەناو بوخچەکە. دواتریش بەم فەرمانەی خوارەوە فایبەر دامەزرێنە:
@@ -124,12 +132,12 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 تایبەتمەندییەکان
-- [ناونیشانی ئاڵۆز](https://docs.gofiber.io/routing)
+- [ناونیشانی ئاڵۆز](https://docs.gofiber.io/guide/routing)
- [فایلی جێگیر](https://docs.gofiber.io/api/app#static)
- [خێراییەکی](https://docs.gofiber.io/extra/benchmarks) بێوێنە
- بەکارهێنانی [میمۆریی کەم](https://docs.gofiber.io/extra/benchmarks)
- توانای هەبوونی لقی [API](https://docs.gofiber.io/api/ctx)
-- پشتگیریی [Middleware](https://docs.gofiber.io/middleware) و [Next](https://docs.gofiber.io/api/ctx#next) وەک Express
+- پشتگیریی [Middleware](https://docs.gofiber.io/category/-middleware) و [Next](https://docs.gofiber.io/api/ctx#next) وەک Express
- پڕۆگرامکردنی [خێرا](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497)ی ڕاژە
- [داڕێژە](https://github.com/gofiber/template)
- پشتگیریی [WebSocket](https://github.com/gofiber/websocket)
@@ -439,7 +447,7 @@ func main() {
### وەڵامی JSON
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -581,7 +589,7 @@ func main() {
app := fiber.New(fiber.Config{
EnableTrustedProxyCheck: true,
TrustedProxies: []string{"0.0.0.0", "1.1.1.1/30"}, // IP address or IP address range
- ProxyHeader: fiber.HeaderXForwardedFor},
+ ProxyHeader: fiber.HeaderXForwardedFor,
})
// ...
@@ -619,6 +627,11 @@ func main() {
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
+| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
## 🧬 کاڵا دەرەکییەکان
@@ -626,12 +639,7 @@ func main() {
| کاڵا | دەربارە |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
@@ -693,7 +701,6 @@ For more articles, middlewares, examples or tools check our [awesome list](https
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_de.md b/.github/README_de.md
index 09a9043003..8cddd01415 100644
--- a/.github/README_de.md
+++ b/.github/README_de.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -114,7 +122,7 @@ Diese Tests wurden von [TechEmpower](https://www.techempower.com/benchmarks/#sec
## ⚙️ Installation
-Stelle sicher, dass du Go installiert hast ([Download hier](https://go.dev/dl/)). Version `1.16` oder neuer wird zu der Nutzung Fibers benötigt.
+Stelle sicher, dass du Go installiert hast ([Download hier](https://go.dev/dl/)). Version `1.17` oder neuer wird zu der Nutzung Fibers benötigt.
Erstelle ein neues Project, indem du zunächst einen neuen Ordner erstellst und dort in diesem Ordner `go mod init github.com/dein/repo` ausführst ([hier mehr dazu](https://go.dev/blog/using-go-modules)). Daraufhin kannst du Fiber mit dem [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) Kommandozeilenbefehl installieren:
@@ -124,12 +132,12 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 Eigenschaften
-- Robustes [Routing](https://docs.gofiber.io/routing)
+- Robustes [Routing](https://docs.gofiber.io/guide/routing)
- Bereitstellen von [statischen Dateien](https://docs.gofiber.io/api/app#static)
- Extreme [Performance](https://docs.gofiber.io/extra/benchmarks)
- [Geringe Arbeitsspeichernutzung](https://docs.gofiber.io/extra/benchmarks)
- Express [API Endpunkte](https://docs.gofiber.io/api/ctx)
-- [Middleware](https://docs.gofiber.io/middleware) & [Next](https://docs.gofiber.io/api/ctx#next) Support
+- [Middleware](https://docs.gofiber.io/category/-middleware) & [Next](https://docs.gofiber.io/api/ctx#next) Support
- [Schnelle](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) serverseitige Programmierung
- [Template engines](https://github.com/gofiber/template)
- [WebSocket support](https://github.com/gofiber/websocket)
@@ -145,7 +153,7 @@ Neue Gopher, welche von [Node.js](https://nodejs.org/en/about/) zu [Go](https://
Fiber ist **inspiriert** von Express.js, dem beliebtesten Web-Framework im Internet. Wir haben die **Leichtigkeit** von Express und die **Rohleistung** von Go kombiniert. Wenn du jemals eine Webanwendung mit Node.js implementiert hast (_mit Express.js oder ähnlichem_), werden dir viele Methoden und Prinzipien **sehr vertraut** vorkommen.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.20.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.17 to 1.20.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 Beispiele
@@ -434,7 +442,7 @@ func main() {
### JSON Response
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -589,6 +597,11 @@ Hier finden Sie eine Liste der Middleware, die im Fiber-Framework enthalten ist.
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
+| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
## 🧬 External Middleware
@@ -596,12 +609,7 @@ Liste der extern gehosteten Middleware-Module, die vom [Fiber team](https://gith
| Middleware | Description |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. || [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
@@ -663,7 +671,6 @@ Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_es.md b/.github/README_es.md
index 54b6385f78..46b0927a9e 100644
--- a/.github/README_es.md
+++ b/.github/README_es.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -114,7 +122,7 @@ Estas pruebas son realizadas por [TechEmpower](https://www.techempower.com/bench
## ⚙️ Instalación
-Asegúrese de tener instalado Go ([descargar](https://go.dev/dl/)). Versión `1.16` o superior.
+Asegúrese de tener instalado Go ([descargar](https://go.dev/dl/)). Versión `1.17` o superior.
Arranque su proyecto creando una nueva carpeta y ejecutando `go mod init github.com/your/repo` ([mas información](https://go.dev/blog/using-go-modules)) dentro del mismo directorio. Después instale Fiber mediante el comando [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them):
@@ -124,7 +132,7 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 Características
-- [Enrutamiento](https://docs.gofiber.io/routing) robusto
+- [Enrutamiento](https://docs.gofiber.io/guide/routing) robusto
- Servir [archivos estáticos](https://docs.gofiber.io/api/app#static)
- [Rendimiento](https://docs.gofiber.io/extra/benchmarks) extremo
- [Bajo](https://docs.gofiber.io/extra/benchmarks) uso de [memoria](https://docs.gofiber.io/extra/benchmarks)
@@ -145,7 +153,7 @@ Los nuevos gophers que hacen el cambio de [Node.js](https://nodejs.org/en/about/
Fiber está **inspirado** en Expressjs, el framework web más popular en Internet. Combinamos la **facilidad** de Express y **el rendimiento bruto** de Go. Si alguna vez ha implementado una aplicación web en Node.js ( _utilizando Express.js o similar_ ), muchos métodos y principios le parecerán **muy comunes** .
## ⚠️ Limitantes
-* Debido a que Fiber utiliza unsafe, la biblioteca no siempre será compatible con la última versión de Go. Fiber 2.40.0 ha sido probado con las versiones de Go 1.16 a 1.20.
+* Debido a que Fiber utiliza unsafe, la biblioteca no siempre será compatible con la última versión de Go. Fiber 2.40.0 ha sido probado con las versiones de Go 1.17 a 1.20.
* Fiber no es compatible con interfaces net/http. Esto significa que no lo podrá usar en proyectos como qglgen, go-swagger, u otros que son parte del ecosistema net/http.
## 👀 Ejemplos
@@ -434,7 +442,7 @@ func main() {
### Respuesta JSON
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -589,6 +597,11 @@ Aquí está una lista del middleware incluido en el marco web Fiber.
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
+| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
## 🧬 Middleware Externo
@@ -596,12 +609,7 @@ Lista de módulos de middleware alojados externamente, y mantenidos por el [equi
| Middleware | Descripción |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
@@ -663,7 +671,6 @@ Copyright (c) 2019-presente [Fenny](https://github.com/fenny) y [contribuyentes]
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_fa.md b/.github/README_fa.md
index 001466ebc0..7c6eec901f 100644
--- a/.github/README_fa.md
+++ b/.github/README_fa.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -133,7 +141,7 @@ func main() {
+مطمئن شوید Go را نصب (دانلود) کرده اید. نسخه 1.17 یا بیشتر مورد نیاز است.
پروژه خود را با ساختن یک پوشه و سپس اجرای go mod init github.com/your/repo
داخل پوشه (یادگیری بیشتر) راه اندازی کنید. سپس Fiber را با دستور go get
نصب کنید :
@@ -153,12 +161,12 @@ go get -u github.com/gofiber/fiber/v3
-- [مسیریابی](https://docs.gofiber.io/routing) قدرتمند
+- [مسیریابی](https://docs.gofiber.io/guide/routing) قدرتمند
- Serve [پرونده های ثابت](https://docs.gofiber.io/api/app#static)
- حداکثر [عملکرد](https://docs.gofiber.io/extra/benchmarks)
- مصرف [حافظه کم](https://docs.gofiber.io/extra/benchmarks)
- قابلیت [API endpoints](https://docs.gofiber.io/api/ctx)
-- پشتیبانی از [Middleware](https://docs.gofiber.io/middleware) & [Next](https://docs.gofiber.io/api/ctx#next)
+- پشتیبانی از [Middleware](https://docs.gofiber.io/category/-middleware) & [Next](https://docs.gofiber.io/api/ctx#next)
- برنامه نویسی سمت سرور [سریع](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497)
- دارای [Template engines](https://github.com/gofiber/template) اختصاصی
- [پشتیبانی از وب سوکت](https://github.com/gofiber/websocket)
@@ -185,7 +193,7 @@ Fiber از Express الهام گرفته, که محبوب ترین فری
## ⚠️ محدودیت ها
-* به دلیل استفاده ناامن از Fiber, ممکن است کتابخانه همیشه با آخرین نسخه Go سازگار نباشد. Fiber 2.40.0 با زبان گو نسخه 1.16 تا 1.20 تست شده است.
+* به دلیل استفاده ناامن از Fiber, ممکن است کتابخانه همیشه با آخرین نسخه Go سازگار نباشد. Fiber 2.40.0 با زبان گو نسخه 1.17 تا 1.20 تست شده است.
* فریمورک Fiber با پکیج net/http سازگار نیست. این بدان معناست شما نمی توانید از پکیج های مانند go-swagger, gqlgen یا سایر پروژه هایی که بخشی از اکوسیستم net/http هستند استفاده کنید.
@@ -530,7 +538,7 @@ func main() {
### JSON Response
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
@@ -58,6 +63,9 @@
+
+
+
@@ -114,7 +122,7 @@ Ces tests sont effectués par [TechEmpower](https://www.techempower.com/benchmar
## ⚙️ Installation
-Make sure you have Go installed ([download](https://go.dev/dl/)). Version `1.16` or higher is required.
+Make sure you have Go installed ([download](https://go.dev/dl/)). Version `1.17` or higher is required.
Initialize your project by creating a folder and then running `go mod init github.com/your/repo` ([learn more](https://go.dev/blog/using-go-modules)) inside the folder. Then install Fiber with the [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) command:
@@ -124,7 +132,7 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 Features
-- [Routing](https://docs.gofiber.io/routing) robuste
+- [Routing](https://docs.gofiber.io/guide/routing) robuste
- Serve [static files](https://docs.gofiber.io/api/app#static)
- [Performances](https://docs.gofiber.io/extra/benchmarks) extrêmes
- [Faible empreinte mémoire](https://docs.gofiber.io/extra/benchmarks)
@@ -145,7 +153,7 @@ Les nouveaux gophers qui passent de [Node.js](https://nodejs.org/en/about/) à [
Fiber est **inspiré** par Express, le framework web le plus populaire d'Internet. Nous avons combiné la **facilité** d'Express, et la **performance brute** de Go. Si vous avez déja développé une application web en Node.js (_en utilisant Express ou équivalent_), alors de nombreuses méthodes et principes vous sembleront **familiers**.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.20.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.17 to 1.20.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 Exemples
@@ -436,7 +444,7 @@ func main() {
### JSON Response
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -591,6 +599,11 @@ Here is a list of middleware that are included within the Fiber framework.
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
+| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
## 🧬 External Middleware
@@ -598,12 +611,7 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
| Middleware | Description |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
@@ -665,7 +673,6 @@ Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_he.md b/.github/README_he.md
index 072385e260..06f9dbe3cc 100644
--- a/.github/README_he.md
+++ b/.github/README_he.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -133,7 +141,7 @@ func main() {
## ⚙️ התקנה
-Make sure you have Go installed ([download](https://go.dev/dl/)). Version `1.16` or higher is required.
+Make sure you have Go installed ([download](https://go.dev/dl/)). Version `1.17` or higher is required.
Initialize your project by creating a folder and then running `go mod init github.com/your/repo` ([learn more](https://go.dev/blog/using-go-modules)) inside the folder. Then install Fiber with the [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) command:
@@ -147,14 +155,14 @@ go get -u github.com/gofiber/fiber/v3
@@ -58,6 +63,9 @@
+
+
+
@@ -114,7 +122,7 @@ Pengukuran ini dilakukan oleh [TechEmpower](https://www.techempower.com/benchmar
## ⚙️ Instalasi
-Pastikan kamu sudah menginstalasi Golang ([unduh](https://go.dev/dl/)). Dengan versi `1.16` atau lebih tinggi [ Direkomendasikan ].
+Pastikan kamu sudah menginstalasi Golang ([unduh](https://go.dev/dl/)). Dengan versi `1.17` atau lebih tinggi [ Direkomendasikan ].
Inisialisasi proyek kamu dengan membuat folder lalu jalankan `go mod init github.com/nama-kamu/repo` ([belajar lebih banyak](https://go.dev/blog/using-go-modules)) di dalam folder. Kemudian instal Fiber dengan perintah [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them):
@@ -124,7 +132,7 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 Fitur
-- Sistem [Routing](https://docs.gofiber.io/routing) yang padu
+- Sistem [Routing](https://docs.gofiber.io/guide/routing) yang padu
- Menyajikan [file statis](https://docs.gofiber.io/api/app#static)
- [Kinerja](https://docs.gofiber.io/extra/benchmarks) ekstrim
- [Penggunaan memori](https://docs.gofiber.io/extra/benchmarks) yang kecil
@@ -148,7 +156,7 @@ Kami **mendengarkan** para pengguna di [GitHub Issues](https://github.com/gofibe
## ⚠️ Limitasi
-* Karena penggunaan Fiber yang tidak aman, perpustakaan mungkin tidak selalu kompatibel dengan versi Go terbaru. Fiber 2.40.0 telah diuji dengan Go versi 1.16 hingga 1.20.
+* Karena penggunaan Fiber yang tidak aman, perpustakaan mungkin tidak selalu kompatibel dengan versi Go terbaru. Fiber 2.40.0 telah diuji dengan Go versi 1.17 hingga 1.20.
* Fiber tidak kompatibel dengan antarmuka net/http. Ini berarti kamu tidak akan dapat menggunakan proyek seperti gqlgen, go-swagger, atau lainnya yang merupakan bagian dari ekosistem net/http.
## 👀 Contoh
@@ -437,7 +445,7 @@ func main() {
### JSON Response
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -592,6 +600,11 @@ Kumpulan `middleware` yang ada didalam kerangka kerja Fiber.
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
+| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
## 🧬 Middleware External
@@ -599,12 +612,7 @@ Kumpulan `middleware` yang dihost external dan diurus oleh [Tim Fiber](https://g
| Middleware | Description |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
@@ -666,7 +674,6 @@ Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_it.md b/.github/README_it.md
index d86385b44b..b5ecf26179 100644
--- a/.github/README_it.md
+++ b/.github/README_it.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -114,7 +122,7 @@ Questi test sono stati eseguiti da [TechEmpower](https://www.techempower.com/ben
## ⚙️ Installazione
-Assicurati di avere Go ([per scaricalro](https://go.dev/dl/)) installato. Devi avere la versione `1.16` o superiore.
+Assicurati di avere Go ([per scaricarlo](https://go.dev/dl/)) installato. Devi avere la versione `1.17` o superiore.
Inizializza il tuo progetto creando una cartella e successivamente usando il comando `go mod init github.com/la-tua/repo` ([per maggiori informazioni](https://go.dev/blog/using-go-modules)) dentro la cartella. Dopodiche installa Fiber con il comando [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them):
@@ -124,7 +132,7 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 Caratteristiche
-- [Routing](https://docs.gofiber.io/routing) solido
+- [Routing](https://docs.gofiber.io/guide/routing) solido
- Serve [file statici](https://docs.gofiber.io/api/app#static)
- [Perfomance](https://docs.gofiber.io/extra/benchmarks) estreme
- [Basso](https://docs.gofiber.io/extra/benchmarks) utilizzo di [memoria](https://docs.gofiber.io/extra/benchmarks)
@@ -142,11 +150,11 @@ go get -u github.com/gofiber/fiber/v3
I nuovi gopher che passano da [Node.js](https://nodejs.org/en/about/) a [Go](https://go.dev/doc/) hanno a che fare con una curva di apprendimento prima di poter iniziare a creare le proprie applicazioni web o microservizi. Fiber, come **web framework** , è stato creato con l'idea di **minimalismo** e seguendo lo '**UNIX way**' , così i nuovi gopher posso entrare rapidamente nel mondo di Go con un caldo e fidato benvenuto.
-Fiber è **ispirato** da Express, il web framework più popolare su internet. Abbiamo combiniamo la **facilità** di Express e **le prestazioni** di Go. Se hai mai implementato una applicazione web in Node.js (_utilizzando Express o simili_), allora i tanti metodi e principi ti saranno **molto familiari**.
+Fiber è **ispirato** da Express, il web framework più popolare su internet. Abbiamo combinato la **facilità** di Express e **le prestazioni** di Go. Se hai mai implementato una applicazione web in Node.js (_utilizzando Express o simili_), allora i tanti metodi e principi ti saranno **molto familiari**.
## ⚠️ Limitazioni
-* Dato che Fiber utilizza unsafe, la libreria non sempre potrebbe essere compatibile con l'ultima versione di Go. Fiber 2.40.0 è stato testato con la versioni 1.16 alla 1.20 di Go.
+* Dato che Fiber utilizza unsafe, la libreria non sempre potrebbe essere compatibile con l'ultima versione di Go. Fiber 2.40.0 è stato testato con la versioni 1.17 alla 1.20 di Go.
* Fiber non è compatibile con le interfacce net/http. Questo significa che non è possibile utilizzare progetti come qglgen, go-swagger, o altri che fanno parte dell'ecosistema net/http.
## 👀 Esempi
@@ -435,7 +443,7 @@ func main() {
### Risposte JSON
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -577,7 +585,7 @@ func main() {
app := fiber.New(fiber.Config{
EnableTrustedProxyCheck: true,
TrustedProxies: []string{"0.0.0.0", "1.1.1.1/30"}, // IP address or IP address range
- ProxyHeader: fiber.HeaderXForwardedFor},
+ ProxyHeader: fiber.HeaderXForwardedFor,
})
// ...
@@ -594,27 +602,32 @@ Qui una lista dei middleware inclusi con Fiber.
| Middleware | Descrizione |
| :------------------------------------------------------------------------------------- |:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Middleware basico di autenticazione usando http. Chiama il suo handler se le credenziali sono guiste e il codice 401 Unauthorized per credenziali mancanti o invailde. |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Middleware basico di autenticazione usando http. Chiama il suo handler se le credenziali sono giuste e il codice 401 Unauthorized per credenziali mancanti o invalide. |
| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercetta e mette nella cache la risposta |
-| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Middlewere di compressione per Fiber, supporta `deflate`, `gzip` e `brotli` di default. |
-| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Ti permette di usare cross-origin resource sharing \(CORS\) con tante optzioni. |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Middleware di compressione per Fiber, supporta `deflate`, `gzip` e `brotli` di default. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Ti permette di usare cross-origin resource sharing \(CORS\) con tante opzioni. |
| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Ti protegge da attachi CSRF. |
| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Middleware che encrypta i valori dei cookie. |
| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Esporre le variabili di ambiente fornendo una configurazione facoltativa. |
-| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | Middlewere che permette alle cache di essere piu efficienti e salvare banda, come un web server non deve rimandare il messagio pieno se il contenuto non è cambiato. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | Middleware che permette alle cache di essere più efficienti e salvare banda, come un web server che non deve rimandare il messagio pieno se il contenuto non è cambiato. |
| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Middleware che serve via il suo runtime server HTTP varianti esposte in formato JSON. |
-| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignora favicon dai logs o serve dalla memoria se un filepath si dà. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignora favicon dai logs o serve dalla memoria se un filepath è specificato. |
| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | Middleware per il FileSystem per Fiber, grazie tante e crediti a Alireza Salary |
-| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Middelwere per Rate-limiting per Fiber. Usato per limitare richieste continue agli APIs publici e/o endpoints come un password reset. |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Middleware per Rate-limiting per Fiber. Usato per limitare richieste continue agli APIs publici e/o endpoints come un password reset. |
| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | Logger HTTP per richiesta/risposta. |
| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Middleware per monitorare che riporta metriche server, ispirato da express-status-monitor |
| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Grazie tante a Matthew Lee \(@mthli\) |
| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Ti permette di fare richieste proxy a multipli server. |
-| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Middleware per recuperare dai attachi di panico da tutte le parti nella stack chain e da il controllo al centralizzato[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Middleware per recuperare dagli attachi di panico da tutte le parti nella stack chain e affida il controllo al [ ErrorHandler](https://docs.gofiber.io/guide/error-handling) centralizzato. |
| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | Aggiunge un requestid a ogni richiesta. |
-| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Middelwere per sessioni. NOTA: Questo middleware usa il nostro Storage package. |
+| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Middleware per sessioni. NOTA: Questo middleware usa il nostro Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Middleware che salta un wrapped handler se un predicate è vero. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Aggiunge un tempo massimo per una richiesta e lo manda a ErrorHandler se si supera. |
+| [keyauth](https://github.com/gofiber/keyauth) | Usa auth basato su chiavi. |
+| [redirect](https://github.com/gofiber/redirect) | Middleware per reinderizzare |
+| [rewrite](https://github.com/gofiber/rewrite) | Riscrive la path all URL con le regole date. Può essere di aiuto per compatibilità o per creare link puliti e più descrittivi. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converte gli handler net/http a/da i request handlers di Fiber, grazie tante a @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Aiuta a mettere sicurezza alla tua app usando vari header HTTP. |
## 🧬 Middleware Esterni
@@ -622,12 +635,7 @@ La lista dei moduli middleware hostati esternamente e mantenuti dal [team di Fib
| Middleware | Descrizione |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converte gli handler net/http a/da i request handlers di Fiber, grazie tante a @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Aiuta a mettere sicurezza alla tua app usando vari header HTTP. |
| [jwt](https://github.com/gofiber/jwt) | Usa JSON Web Token \(JWT\) auth. |
-| [keyauth](https://github.com/gofiber/keyauth) | Usa auth basato su chiavi. |
-| [redirect](https://github.com/gofiber/redirect) | Middleware per reinderizzare |
-| [rewrite](https://github.com/gofiber/rewrite) | Riscrive la path all URL con le regole date. Puo essere di aiuto per compatibilita o per creare link puliti e piu descrittivi. |
| [storage](https://github.com/gofiber/storage) | Dirver di storage che implementa la interfaccia Storage, fatto per essere usato con vari Fiber middleware. |
| [template](https://github.com/gofiber/template) | Questo pachetto contiene 8 motori template che possono essere usati con Fiber `v1.10.x`. Versione di go neccesaria: 1.13+. |
| [websocket](https://github.com/gofiber/websocket) | Basato su Fasthttp WebSocket per Fiber con supporto per Locals! |
@@ -689,7 +697,6 @@ Copyright (c) 2019-ora [Fenny](https://github.com/fenny) e [Contributors](https:
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_ja.md b/.github/README_ja.md
index 39477937d8..e6c350b5b2 100644
--- a/.github/README_ja.md
+++ b/.github/README_ja.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -115,7 +123,7 @@ func main() {
## ⚙️ インストール
-Go がインストールされていることを確認してください ([ダウンロード](https://go.dev/dl/)). バージョン `1.16` またはそれ以上であることが必要です。
+Go がインストールされていることを確認してください ([ダウンロード](https://go.dev/dl/)). バージョン `1.17` またはそれ以上であることが必要です。
フォルダを作成し、フォルダ内で `go mod init github.com/your/repo` ([learn more](https://go.dev/blog/using-go-modules)) を実行してプロジェクトを初期化してください。その後、 Fiber を以下の [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) コマンドでインストールしてください。
@@ -125,7 +133,7 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 機能
-- 堅牢な[ルーティング](https://docs.gofiber.io/routing)
+- 堅牢な[ルーティング](https://docs.gofiber.io/guide/routing)
- [静的ファイル](https://docs.gofiber.io/api/app#static)のサポート
- 究極の[パフォーマンス](https://docs.gofiber.io/extra/benchmarks)
- [低メモリ](https://docs.gofiber.io/extra/benchmarks)フットプリント
@@ -150,7 +158,7 @@ Fiber は人気の高い Web フレームワークである Expressjs に**イ
## ⚠️ 制限事項
-- Fiber は unsafe パッケージを使用しているため、最新の Go バージョンと互換性がない場合があります。Fiber 2.40.0 は、Go のバージョン 1.16 から 1.20 でテストされています。
+- Fiber は unsafe パッケージを使用しているため、最新の Go バージョンと互換性がない場合があります。Fiber 2.40.0 は、Go のバージョン 1.17 から 1.20 でテストされています。
- Fiber は net/http インターフェースと互換性がありません。つまり、gqlgen や go-swagger など、net/http のエコシステムの一部であるプロジェクトを使用することができません。
## 👀 例
@@ -439,7 +447,7 @@ func main() {
### JSON Response
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -594,6 +602,11 @@ func main() {
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
+| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
## 🧬 外部ミドルウェア
@@ -601,12 +614,7 @@ func main() {
| Middleware | Description |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
@@ -668,7 +676,6 @@ Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_ko.md b/.github/README_ko.md
index f7e6aa966c..c6b2eed2c1 100644
--- a/.github/README_ko.md
+++ b/.github/README_ko.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -114,7 +122,7 @@ func main() {
## ⚙️ 설치
-Go가 설치되어 있는 것을 확인해 주세요 ([download](https://go.dev/dl/)). 버전 1.16 또는 그 이상이어야 합니다.
+Go가 설치되어 있는 것을 확인해 주세요 ([download](https://go.dev/dl/)). 버전 1.17 또는 그 이상이어야 합니다.
폴더를 생성하여 당신의 프로젝트를 초기화하고, 폴더 안에서 `go mod init github.com/your/repo` ([learn more](https://go.dev/blog/using-go-modules)) 를 실행하세요. 그리고 [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) 명령어로 Fiber를 설치하세요:
@@ -124,7 +132,7 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 특징
-- 견고한 [라우팅](https://docs.gofiber.io/routing)
+- 견고한 [라우팅](https://docs.gofiber.io/guide/routing)
- [정적 파일](https://docs.gofiber.io/api/app#static) 제공
- 뛰어난 [성능](https://docs.gofiber.io/extra/benchmarks)
- [적은 메모리](https://docs.gofiber.io/extra/benchmarks) 공간
@@ -147,7 +155,7 @@ Fiber는 인터넷에서 가장 인기있는 웹 프레임워크인 Express에
우리는 **어떤한** 작업, **마감일정**, 개발자의 **기술**이던간에 **빠르고**, **유연하고**, **익숙한** Go 웹 프레임워크를 만들기 위해 사용자들의 [이슈들](https://github.com/gofiber/fiber/issues)을(그리고 모든 인터넷을 통해) **듣고 있습니다**! Express가 자바스크립트 세계에서 하는 것 처럼요.
## ⚠️ 한계점
-* Fiber는 unsafe 패키지를 사용하기 때문에 최신 Go버전과 호환되지 않을 수 있습니다.Fiber 2.40.0은 Go 버전 1.16에서 1.20로 테스트되고 있습니다.
+* Fiber는 unsafe 패키지를 사용하기 때문에 최신 Go버전과 호환되지 않을 수 있습니다.Fiber 2.40.0은 Go 버전 1.17에서 1.20로 테스트되고 있습니다.
* Fiber는 net/http 인터페이스와 호환되지 않습니다.즉, gqlgen이나 go-swagger 등 net/http 생태계의 일부인 프로젝트를 사용할 수 없습니다.
## 👀 예제
@@ -440,7 +448,7 @@ func main() {
### JSON Response
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -595,6 +603,11 @@ Fiber 프레임워크에 포함되는 미들웨어 목록입니다.
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
+| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
## 🧬 External Middleware
@@ -602,12 +615,7 @@ Fiber 프레임워크에 포함되는 미들웨어 목록입니다.
| Middleware | Description |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
@@ -669,7 +677,6 @@ Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_nl.md b/.github/README_nl.md
index 3c302bfdac..5d58f24286 100644
--- a/.github/README_nl.md
+++ b/.github/README_nl.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -114,7 +122,7 @@ Deze tests zijn uitgevoerd door [TechEmpower](https://www.techempower.com/benchm
## ⚙️ Installatie
-Make sure you have Go installed ([download](https://go.dev/dl/)). Version `1.16` or higher is required.
+Make sure you have Go installed ([download](https://go.dev/dl/)). Version `1.17` or higher is required.
Initialize your project by creating a folder and then running `go mod init github.com/your/repo` ([learn more](https://go.dev/blog/using-go-modules)) inside the folder. Then install Fiber with the [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) command:
@@ -124,17 +132,17 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 Features
-- Robuuste [routing](https://docs.gofiber.io/routing)
+- Robuuste [routing](https://docs.gofiber.io/guide/routing)
- Serveer [statische bestanden](https://docs.gofiber.io/api/app#static)
- Extreme [prestaties](https://docs.gofiber.io/extra/benchmarks)
- [Weinig geheugenruimte](https://docs.gofiber.io/extra/benchmarks)
- [API endpoints](https://docs.gofiber.io/api/ctx)
-- [Middleware](https://docs.gofiber.io/middleware) & [Next](https://docs.gofiber.io/api/ctx#next) ondersteuning
+- [Middleware](https://docs.gofiber.io/category/-middleware) & [Next](https://docs.gofiber.io/api/ctx#next) ondersteuning
- [Snelle](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) server-side programmering
- [Template engines](https://github.com/gofiber/template)
- [WebSocket ondersteuning](https://github.com/gofiber/websocket)
- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
-- [Rate Limiter](https://docs.gofiber.io/middleware/limiter)
+- [Rate Limiter](https://docs.gofiber.io/category/-middleware/limiter)
- Vertaald in [18 talen](https://docs.gofiber.io/)
- En nog veel meer, [ontdek Fiber](https://docs.gofiber.io/)
@@ -147,7 +155,7 @@ Fiber is **geïnspireerd** door Express, het populairste webframework op interne
We **luisteren** naar onze gebruikers in [issues](https://github.com/gofiber/fiber/issues) (_en overal op het internet_) om een **snelle**, **flexibele** en **vriendelijk** Go web framework te maken voor **elke** taak, **deadline** en ontwikkelaar **vaardigheid**! Net zoals Express dat doet in de JavaScript-wereld.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.20.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.17 to 1.20.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 Voorbeelden
@@ -440,7 +448,7 @@ func main() {
### JSON Response
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -595,6 +603,11 @@ Here is a list of middleware that are included within the Fiber framework.
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
+| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
## 🧬 External Middleware
@@ -602,12 +615,7 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
| Middleware | Description |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
@@ -669,7 +677,6 @@ Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_pt.md b/.github/README_pt.md
index eb6ca2f3de..f0d69774e2 100644
--- a/.github/README_pt.md
+++ b/.github/README_pt.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -114,7 +122,7 @@ Esses testes são realizados pelo [TechEmpower](https://www.techempower.com/benc
## ⚙️ Instalação
-Certifique-se de ter o Go instalado ([download](https://go.dev/dl/)). Versão `1.16` ou superior é obrigatória.
+Certifique-se de ter o Go instalado ([download](https://go.dev/dl/)). Versão `1.17` ou superior é obrigatória.
Inicie seu projeto criando um diretório e então execute `go mod init github.com/your/repo` ([saiba mais](https://go.dev/blog/using-go-modules)) dentro dele. Então, instale o Fiber com o comando [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them):
@@ -124,7 +132,7 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 Recursos
-- [Roteamento](https://docs.gofiber.io/routing) robusto
+- [Roteamento](https://docs.gofiber.io/guide/routing) robusto
- Servir [arquivos estáticos](https://docs.gofiber.io/api/app#static)
- [Desempenho](https://docs.gofiber.io/extra/benchmarks) extremo
- [Baixo consumo de memória](https://docs.gofiber.io/extra/benchmarks)
@@ -145,7 +153,7 @@ Os novos gophers que mudaram do [Node.js](https://nodejs.org/en/about/) para o [
O Fiber é **inspirado** no Express, o framework web mais popular da Internet. Combinamos a **facilidade** do Express e com o **desempenho bruto** do Go. Se você já implementou um aplicativo web com Node.js ( _usando Express.js ou similar_ ), então muitos métodos e princípios parecerão **muito familiares** para você.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.20.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.17 to 1.20.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 Exemplos
@@ -434,7 +442,7 @@ func main() {
### Resposta JSON
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -589,6 +597,11 @@ Here is a list of middleware that are included within the Fiber framework.
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
+| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
## 🧬 External Middleware
@@ -596,12 +609,7 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
| Middleware | Description |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
@@ -665,7 +673,6 @@ O logo oficial foi criado por [Vic Shóstak](https://github.com/koddr) e distrib
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_ru.md b/.github/README_ru.md
index 84a639d96b..c5f25be7be 100644
--- a/.github/README_ru.md
+++ b/.github/README_ru.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -114,7 +122,7 @@ func main() {
## ⚙️ Установка
-Убедитесь, что Go установлен ([скачать](https://go.dev/dl/)). Требуется версия `1.16` или выше.
+Убедитесь, что Go установлен ([скачать](https://go.dev/dl/)). Требуется версия `1.17` или выше.
Инициализируйте проект, создав папку, а затем запустив `go mod init github.com/your/repo` ([подробнее](https://go.dev/blog/using-go-modules)) внутри этой папки. Далее, установите Fiber с помощью команды [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them):
@@ -124,12 +132,12 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 Особенности
-- Надежная [маршрутизация](https://docs.gofiber.io/routing)
+- Надежная [маршрутизация](https://docs.gofiber.io/guide/routing)
- Доступ к [статичным файлам](https://docs.gofiber.io/api/app#static)
- Экстремальная [производительность](https://docs.gofiber.io/extra/benchmarks)
- [Низкий объем потребления памяти](https://docs.gofiber.io/extra/benchmarks)
- [Эндпоинты](https://docs.gofiber.io/context), как в [API](https://docs.gofiber.io/api/ctx) Express
-- [Middleware](https://docs.gofiber.io/middleware) и поддержка [Next](https://docs.gofiber.io/api/ctx#next)
+- [Middleware](https://docs.gofiber.io/category/-middleware) и поддержка [Next](https://docs.gofiber.io/api/ctx#next)
- [Быстрое](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) программирование на стороне сервера
- [Template engines](https://github.com/gofiber/template)
- [Поддержка WebSocket](https://github.com/gofiber/websocket)
@@ -146,9 +154,9 @@ Fiber **вдохновлен** Express, самым популярным веб
Мы **прислушиваемся** к нашим пользователям в [issues](https://github.com/gofiber/fiber/issues), Discord [канале](https://gofiber.io/discord) _и в остальном Интернете_, чтобы создать **быстрый**, **гибкий** и **дружелюбный** веб фреймворк на Go для **любых** задач, **дедлайнов** и **уровней** разработчиков! Как это делает Express в мире JavaScript.
-## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.20.
-* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
+## ⚠️ Ограничения
+* Из-за того, что Fiber использует пакет unsafe, библиотека не всегда может быть совместима с последней версией Go. Fiber 2.40.0 был протестирован с версиями Go от 1.17 до 1.20.
+* Fiber не совместим с интерфейсами net/http. Это означает, что вы не сможете использовать такие проекты, как gqlgen, go-swagger или любые другие, которые являются частью экосистемы net/http.
## 👀 Примеры
@@ -436,7 +444,7 @@ func main() {
### JSON Response
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -596,6 +604,11 @@ func main() {
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
+| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
+| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
## 🧬 Внешние Middleware
@@ -603,19 +616,14 @@ func main() {
| Middleware | Описание |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
-## 🕶️ Awesome List
+## 🕶️ Полезный список
-For more articles, middlewares, examples or tools check our [awesome list](https://github.com/gofiber/awesome-fiber).
+Дополнительные статьи, middleware, примеры или инструменты смотри в нашем [полезном списке](https://github.com/gofiber/awesome-fiber).
## 👍 Помощь проекту
@@ -661,9 +669,9 @@ Fiber — это проект с открытым исходным кодом,
-## ⚠️ License
+## ⚠️ Лицензия
-Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
+Copyright (c) 2019-настоящее время [Fenny](https://github.com/fenny) и [Контрибьютеры](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` - это свободное программное обсепечение с открытым исходным кодом лицензированное под [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Официальный логотип создан [Vic Shóstak](https://github.com/koddr) и распространяется под [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) лицензией (CC BY-SA 4.0 International).
**Third-party library licenses**
@@ -672,7 +680,6 @@ Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_sa.md b/.github/README_sa.md
index fe77f665fc..61ec729bee 100644
--- a/.github/README_sa.md
+++ b/.github/README_sa.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -120,7 +128,7 @@ func main() {
## ⚙️ تثبيت
-تأكد من تثبيت Go ([تحميل](https://go.dev/dl/)). الإصدار `1.16` أو أعلى مطلوب.
+تأكد من تثبيت Go ([تحميل](https://go.dev/dl/)). الإصدار `1.17` أو أعلى مطلوب.
ابدأ مشروعك بإنشاء مجلد ثم تشغيله `go mod init github.com/your/repo` ([أعرف أكثر](https://go.dev/blog/using-go-modules))
داخل المجلد. ثم قم بتثبيت Fiber باستخدام ملف [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) أمر:
@@ -137,12 +145,12 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 الميزات
-- قوي [routing](https://docs.gofiber.io/routing)
+- قوي [routing](https://docs.gofiber.io/guide/routing)
- يقدم خدمة [static files](https://docs.gofiber.io/api/app#static)
- أقصى [أداء](https://docs.gofiber.io/extra/benchmarks)
- [ذاكرة منخفضة](https://docs.gofiber.io/extra/benchmarks)
- [API endpoints](https://docs.gofiber.io/api/ctx)
-- [Middleware](https://docs.gofiber.io/middleware) & [Next](https://docs.gofiber.io/api/ctx#next) مدعوم
+- [Middleware](https://docs.gofiber.io/category/-middleware) & [Next](https://docs.gofiber.io/api/ctx#next) مدعوم
- [سريع](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) server-side programming
- [Template engines](https://github.com/gofiber/template)
- [WebSocket دعم](https://github.com/gofiber/websocket)
@@ -161,7 +169,7 @@ Fiber هو **مستوحى** من Express, إطار الويب الأكثر شع
** و تطوير **مهارات**! فقط مثل Express تفعل لـ JavaScript عالم.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.20.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.17 to 1.20.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 أمثلة
@@ -490,7 +498,7 @@ func main() {
### JSON Response
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
@@ -55,6 +60,9 @@
+
+
+
@@ -114,7 +122,7 @@ Bu testler [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r1
## ⚙️ Kurulum
-Go'nun `1.16` sürümü ([indir](https://go.dev/dl/)) veya daha yüksek bir sürüm gerekli.
+Go'nun `1.17` sürümü ([indir](https://go.dev/dl/)) veya daha yüksek bir sürüm gerekli.
Bir dizin oluşturup dizinin içinde `go mod init github.com/your/repo` komutunu yazarak projenizi geliştirmeye başlayın ([daha fazla öğren](https://go.dev/blog/using-go-modules)). Ardından Fiber'ı kurmak için [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) komutunu çalıştırın:
@@ -124,7 +132,7 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 Özellikler
-- Güçlü [routing](https://docs.gofiber.io/routing)
+- Güçlü [routing](https://docs.gofiber.io/guide/routing)
- [Statik dosya](https://docs.gofiber.io/api/app#static) sunumu
- Olağanüstü [performans](https://docs.gofiber.io/extra/benchmarks)
- [Düşük bellek](https://docs.gofiber.io/extra/benchmarks) kullanımı
@@ -146,7 +154,7 @@ Fiber, internet üzerinde en popüler web framework'ü olan Express'ten **esinle
## ⚠️ Sınırlamalar
-- Fiber unsafe kullanımı sebebiyle Go'nun son sürümüyle her zaman uyumlu olmayabilir. Fiber 2.40.0, Go 1.16 ile 1.20 sürümleriyle test edildi.
+- Fiber unsafe kullanımı sebebiyle Go'nun son sürümüyle her zaman uyumlu olmayabilir. Fiber 2.40.0, Go 1.17 ile 1.20 sürümleriyle test edildi.
- Fiber net/http arabirimiyle uyumlu değildir. Yani gqlgen veya go-swagger gibi net/http ekosisteminin parçası olan projeleri kullanamazsınız.
## 👀 Örnekler
@@ -434,7 +442,7 @@ func main() {
### JSON Yanıtları
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -589,6 +597,11 @@ Fiber'a dahil edilen middlewareların bir listesi aşağıda verilmiştir.
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session için middleware. NOTE: Bu middleware Fiber'in Storage yapısını kullanır. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware'ı verilen koşul `true` olduğunda handler'ı atlar ve işlemez. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Bir request için maksimum süre ekler ve aşılırsa ErrorHandler'a iletir. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware, key tabanlı bir authentication sağlar. |
+| [redirect](https://github.com/gofiber/redirect) | Yönlendirme middleware 'ı. |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware, sağlanan kurallara göre URL yolunu yeniden yazar. Geriye dönük uyumluluk için veya yalnızca daha temiz ve daha açıklayıcı bağlantılar oluşturmak için yardımcı olabilir. |
+| [adaptor](https://github.com/gofiber/adaptor) | Fiber request handlerdan net/http handlerları için dönüştürücü, @arsmn'a özel teşekkürler! |
+| [helmet](https://github.com/gofiber/helmet) | Çeşitli HTTP headerları ayarlayarak uygulamalarınızın güvenliğini sağlamaya yardımcı olur. |
## 🧬 Harici Middlewarelar
@@ -596,14 +609,9 @@ Harici olarak barındırılan middlewareların modüllerinin listesi. Bu middlew
| Middleware | Açıklama |
| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [adaptor](https://github.com/gofiber/adaptor) | Fiber request handlerdan net/http handlerları için dönüştürücü, @arsmn'a özel teşekkürler! |
-| [helmet](https://github.com/gofiber/helmet) | Çeşitli HTTP headerları ayarlayarak uygulamalarınızın güvenliğini sağlamaya yardımcı olur. |
| [jwt](https://github.com/gofiber/jwt) | JWT, bir JSON Web Token \(JWT\) yetkilendirmesi döndüren middleware. |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware, key tabanlı bir authentication sağlar. |
-| [redirect](https://github.com/gofiber/redirect) | Yönlendirme middleware 'ı. |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware, sağlanan kurallara göre URL yolunu yeniden yazar. Geriye dönük uyumluluk için veya yalnızca daha temiz ve daha açıklayıcı bağlantılar oluşturmak için yardımcı olabilir. |
| [storage](https://github.com/gofiber/storage) | Fiber'in Storage yapısını destekleyen birçok storage driver'ı verir. Bu sayede depolama gerektiren Fiber middlewarelarında kolaylıkla kullanılabilir. |
-| [template](https://github.com/gofiber/template) | Bu paket, Fiber `v2.x.x`, Go sürüm 1.16 veya üzeri gerekli olduğunda kullanılabilecek 9 template motoru içerir. |
+| [template](https://github.com/gofiber/template) | Bu paket, Fiber `v2.x.x`, Go sürüm 1.17 veya üzeri gerekli olduğunda kullanılabilecek 9 template motoru içerir. |
| [websocket](https://github.com/gofiber/websocket) | Yereller desteğiyle Fiber için Fasthttp WebSocket'a dayalıdır! |
## 🕶️ Awesome Listesi
@@ -662,7 +670,6 @@ Telif (c) 2019-günümüz [Fenny](https://github.com/fenny) ve [katkıda bulunan
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_uk.md b/.github/README_uk.md
index 82fcb23525..9556e924e1 100644
--- a/.github/README_uk.md
+++ b/.github/README_uk.md
@@ -1,6 +1,11 @@
@@ -61,6 +66,9 @@
+
+
+
@@ -124,7 +132,7 @@ func main() {
## ⚙️ Встановлення
-Переконайтеся, що Go встановлено ([завантажити](https://go.dev/dl/)). Потрібна версія `1.16` або вища.
+Переконайтеся, що Go встановлено ([завантажити](https://go.dev/dl/)). Потрібна версія `1.17` або вища.
Ініціалізуйте проект, створивши папку, а потім запустивши `go mod init github.com/your/repo`
([детальніше](https://go.dev/blog/using-go-modules)) всередині цієї папки. Далі встановіть Fiber за допомогою
@@ -160,7 +168,7 @@ Fiber **натхненний** Express, найпопулярнішим веб-ф
## ⚠️ Обмеження
-- Через те, що Fiber використовує unsafe, бібліотека не завжди може бути сумісною з останньою версією Go. Fiber 2.40.0 було протестовано з Go версій 1.16 до 1.20.
+- Через те, що Fiber використовує unsafe, бібліотека не завжди може бути сумісною з останньою версією Go. Fiber 2.40.0 було протестовано з Go версій 1.17 до 1.20.
- Fiber не сумісний з інтерфейсами net/http. Це означає, що ви не зможете використовувати такі проекти, як gqlgen, go-swagger або будь-які інші, які є частиною екосистеми net/http.
## 👀 Приклади
@@ -586,7 +594,7 @@ func main() {
app := fiber.New(fiber.Config{
EnableTrustedProxyCheck: true,
TrustedProxies: []string{"0.0.0.0", "1.1.1.1/30"}, // IP address or IP address range
- ProxyHeader: fiber.HeaderXForwardedFor},
+ ProxyHeader: fiber.HeaderXForwardedFor,
})
// ...
@@ -624,6 +632,11 @@ func main() {
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Middleware для сеансів. ПРИМІТКА: Цей middleware використовує наш пакет зберігання. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Middleware який пропускає упакований обробник, якщо предикат є істинним. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Додає максимальний час для запиту та пересилає до ErrorHandler, якщо його перевищено. |
+| [keyauth](https://github.com/gofiber/keyauth) | Middleware для автентифікації по ключам. |
+| [redirect](https://github.com/gofiber/redirect) | Middleware для перенаправлення. |
+| [rewrite](https://github.com/gofiber/rewrite) | Middleware для перезапису URL-адреси на основі наданих правил. |
+| [adaptor](https://github.com/gofiber/adaptor) | Конвентор для обробників net/http до/з обробників запитів Fiber, особлива подяка @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Допомагає захистити ваші програми, встановлюючи різні заголовки HTTP. |
## 🧬 Зовнішні Middleware
@@ -631,12 +644,7 @@ func main() {
| Middleware | Опис |
| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
-| [adaptor](https://github.com/gofiber/adaptor) | Конвентор для обробників net/http до/з обробників запитів Fiber, особлива подяка @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | Допомагає захистити ваші програми, встановлюючи різні заголовки HTTP. |
| [jwt](https://github.com/gofiber/jwt) | JWT повертає middleware автентифікації JSON Web Token \(JWT\). |
-| [keyauth](https://github.com/gofiber/keyauth) | Middleware для автентифікації по ключам. |
-| [redirect](https://github.com/gofiber/redirect) | Middleware для перенаправлення. |
-| [rewrite](https://github.com/gofiber/rewrite) | Middleware для перезапису URL-адреси на основі наданих правил. |
| [storage](https://github.com/gofiber/storage) | Драйвер зберігання який може використовуватися в різних middleware. |
| [template](https://github.com/gofiber/template) | Цей пакет містить 8 модулів шаблонів, які можна використовувати з Fiber `v1.10.x` Потрібно версія Go 1.13 або новішу. |
| [websocket](https://github.com/gofiber/websocket) | На основі Fasthttp WebSocket для Fiber з підтримкою місцевих користувачів! |
@@ -698,7 +706,6 @@ Fiber – це проект із відкритим вихідним кодом,
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_zh-CN.md b/.github/README_zh-CN.md
index b69a521d09..d9122531d9 100644
--- a/.github/README_zh-CN.md
+++ b/.github/README_zh-CN.md
@@ -1,6 +1,11 @@
@@ -58,6 +63,9 @@
+
+
+
@@ -116,7 +124,7 @@ func main() {
## ⚙️ 安装
-确保已安装 `1.16` 或更高版本的 Go ([下载](https://go.dev/dl/))。
+确保已安装 `1.17` 或更高版本的 Go ([下载](https://go.dev/dl/))。
通过创建文件夹并在文件夹内运行 `go mod init github.com/your/repo` ([了解更多](https://go.dev/blog/using-go-modules)) 来初始化项目,然后使用 [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) 命令安装 Fiber:
@@ -126,12 +134,12 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 特点
-- 强大的[路由](https://docs.gofiber.io/routing)
+- 强大的[路由](https://docs.gofiber.io/guide/routing)
- [静态文件](https://docs.gofiber.io/api/app#static)服务
- 极致[性能](https://docs.gofiber.io/extra/benchmarks)
- [低内存占用](https://docs.gofiber.io/extra/benchmarks)
- [API 接口](https://docs.gofiber.io/api/ctx)
-- 支持[中间件](https://docs.gofiber.io/middleware)和 [Next](https://docs.gofiber.io/api/ctx#next)
+- 支持[中间件](https://docs.gofiber.io/category/-middleware)和 [Next](https://docs.gofiber.io/api/ctx#next)
- [快速上手](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497)
- [模版引擎](https://github.com/gofiber/template)
- [支持 WebSocket](https://github.com/gofiber/websocket)
@@ -152,7 +160,7 @@ go get -u github.com/gofiber/fiber/v3
以及在互联网上的所有诉求,为了创建一个能让有着任何技术栈的开发者都能在 deadline 前完成任务的**迅速**,**灵活**以及**友好**的 `Go web` 框架,就像 `Express` 在 `JavaScript` 世界中一样。
## ⚠️ 限制
-* 由于 Fiber 使用了 unsafe 特性,导致其可能与最新的 Go 版本不兼容。Fiber 2.40.0 已经在 Go 1.16 到 1.20 上测试过。
+* 由于 Fiber 使用了 unsafe 特性,导致其可能与最新的 Go 版本不兼容。Fiber 2.40.0 已经在 Go 1.17 到 1.20 上测试过。
* Fiber 与 net/http 接口不兼容。也就是说你无法直接使用例如 gqlen,go-swagger 或者任何其他属于 net/http 生态的项目。
## 👀 示例
@@ -252,7 +260,7 @@ func main() {
```
-#### 📖 [**中间件**](https://docs.gofiber.io/middleware)和 [**Next**](https://docs.gofiber.io/api/ctx#next)
+#### 📖 [**中间件**](https://docs.gofiber.io/category/-middleware)和 [**Next**](https://docs.gofiber.io/api/ctx#next)
```go
func main() {
@@ -442,7 +450,7 @@ func main() {
### JSON 响应
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -597,6 +605,11 @@ func main() {
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session 中间件. 注意: 此中间件使用了我们的存储包. |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip 中间件会在判断条为 true 时忽略此次请求 |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | 添加请求的最大时间,如果超时则发送给ErrorHandler 进行处理. |
+| [adaptor](https://github.com/gofiber/adaptor) | net/http 处理程序与 Fiber 请求处理程序之间的转换器,特别感谢 @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | 通过设置各种 HTTP 头帮助保护您的应用程序 |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth 中间件提供基于密钥的身份验证 |
+| [redirect](https://github.com/gofiber/redirect) | 用于重定向请求的中间件 |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite 中间件根据提供的规则重写URL路径。它有助于向后兼容或者创建更清晰、更具描述性的链接 |
## 🧬 外部中间件
@@ -604,12 +617,7 @@ func main() {
| 中间件 | 描述 |
|:--------------------------------------------------|:-------------------------------------------------------------------------------------------|
-| [adaptor](https://github.com/gofiber/adaptor) | net/http 处理程序与 Fiber 请求处理程序之间的转换器,特别感谢 @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | 通过设置各种 HTTP 头帮助保护您的应用程序 |
| [jwt](https://github.com/gofiber/jwt) | JWT 返回一个 JSON Web Token\(JWT\) 身份验证中间件 |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth 中间件提供基于密钥的身份验证 |
-| [redirect](https://github.com/gofiber/redirect) | 用于重定向请求的中间件 |
-| [rewrite](https://github.com/gofiber/rewrite) | Rewrite 中间件根据提供的规则重写URL路径。它有助于向后兼容或者创建更清晰、更具描述性的链接 |
| [storage](https://github.com/gofiber/storage) | 包含实现 Storage 接口的数据库驱动,它的设计旨在配合 fiber 的其他中间件来进行使用 |
| [template](https://github.com/gofiber/template) | 该中间件包含 8 个模板引擎,可与 Fiber `v1.10.x` Go 1.13或更高版本一起使用 |
| [websocket](https://github.com/gofiber/websocket) | 基于 Fasthttp WebSocket for Fiber 实现,支持使用 [Locals](https://docs.gofiber.io/api/ctx#locals) ! |
@@ -672,7 +680,6 @@ Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/README_zh-TW.md b/.github/README_zh-TW.md
index 0a10c14391..84ea8c4f5c 100644
--- a/.github/README_zh-TW.md
+++ b/.github/README_zh-TW.md
@@ -1,6 +1,11 @@
@@ -61,6 +66,9 @@
+
+
+
@@ -118,7 +126,7 @@ func main() {
## ⚙️ 安裝
-先確定您已經安裝 `1.16` 或更新版本的 Go([點此下載](https://go.dev/dl/))。
+先確定您已經安裝 `1.17` 或更新版本的 Go([點此下載](https://go.dev/dl/))。
要初始化專案,首先建立檔案夾,然後在檔案夾中執行 `go mod init github.com/名稱/儲存庫`([深入了解](https://go.dev/blog/using-go-modules))。接著,使用 [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) 命令安裝 Fiber:
@@ -128,13 +136,20 @@ go get -u github.com/gofiber/fiber/v3
## 🎯 特色
-- 強固的[路由系統](https://docs.gofiber.io/routing)
+- 強固的[路由系統](https://docs.gofiber.io/guide/routing)
- 可以寄存[靜態檔案](https://docs.gofiber.io/api/app#static)
- 疾速[效能](https://docs.gofiber.io/extra/benchmarks)
- 相當低的[記憶體使用量](https://docs.gofiber.io/extra/benchmarks)
- [API 端點](https://docs.gofiber.io/api/ctx)
-- 支援 [中介模組](https://docs.gofiber.io/middleware) 和 [接續函式 (Next)](https://docs.gofiber.io/api/ctx#next)
+- 支援 [中介模組](https://docs.gofiber.io/category/-middleware) 和 [接續函式 (Next)](https://docs.gofiber.io/api/ctx#next)
- [迅速開發](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) 伺服器端服務
+- 強大的[路由](https://docs.gofiber.io/guide/routing)
+- [靜態檔案](https://docs.gofiber.io/api/app#static)服務
+- [超快速](https://docs.gofiber.io/extra/benchmarks)
+- [佔用很少記憶體](https://docs.gofiber.io/extra/benchmarks)
+- 支援 Express 的[API](https://docs.gofiber.io/api/ctx)
+- 支援中介器和[下一步](https://docs.gofiber.io/api/ctx#next)
+- [立即上手](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497)
- [樣板引擎](https://github.com/gofiber/template)
- [支援 WebSocket](https://github.com/gofiber/websocket)
- [Server-Sent Events](https://github.com/gofiber/recipes/tree/master/sse)
@@ -152,7 +167,7 @@ Fiber **啟發自** Express——網際網路上最知名的 Web 框架,我們
## ⚠️ 限制
-- 由於 Fiber 有用到 Unsafe,本函式庫有時可能無法相容最新版的 Go 語言。Fiber 2.40.0 已在 Go 1.16 至 1.20 的版本測試過。
+- 由於 Fiber 有用到 Unsafe,本函式庫有時可能無法相容最新版的 Go 語言。Fiber 2.40.0 已在 Go 1.17 至 1.20 的版本測試過。
- Fiber 不相容 net/http 的介面,意味著您無法使用像是 gqlgen、go-swagger 或其他任何屬於 net/http 生態系統的專案。
## 👀 範例
@@ -441,7 +456,7 @@ func main() {
### JSON 回應
-📖 [JSON](https://docs.gofiber.io/ctx#json)
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
```go
type User struct {
@@ -583,7 +598,7 @@ func main() {
app := fiber.New(fiber.Config{
EnableTrustedProxyCheck: true,
TrustedProxies: []string{"0.0.0.0", "1.1.1.1/30"}, // IP 地址或 IP 地址區間
- ProxyHeader: fiber.HeaderXForwardedFor},
+ ProxyHeader: fiber.HeaderXForwardedFor,
})
// ...
@@ -621,6 +636,11 @@ func main() {
| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | 連線階段中介模組。注意:這個中介模組有用到我們的 Storage 套件。 |
| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | 略過中介模組,會在條件成立時略過封裝過的處理常式。 |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | 為請求加上最長時限,並在逾時後轉送至錯誤處理常式 (ErrorHandler)。 |
+| [keyauth](https://github.com/gofiber/keyauth) | Key auth 中介模組提供以金鑰為基礎的認證模式。 |
+| [redirect](https://github.com/gofiber/redirect) | 用來重新導向的中介模組。 |
+| [rewrite](https://github.com/gofiber/rewrite) | 重寫 (Rewrite) 中介模組:根據提供規則重寫 URL 路徑,適合用來向後相容,或者是製作更乾淨且更好懂的連結。 |
+| [adaptor](https://github.com/gofiber/adaptor) | 將 net/http 處理常式轉換至 Fiber 處理常式,或者是反著做。特別感謝 @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | 透過設定多種 HTTP 標頭,協助保護您應用程式的安全。 |
## 🧬 外掛中介模組
@@ -628,12 +648,7 @@ func main() {
| 中介模組 | 描述 |
| :------------------------------------------------ | :----------------------------------------------------------------------------------------------------- |
-| [adaptor](https://github.com/gofiber/adaptor) | 將 net/http 處理常式轉換至 Fiber 處理常式,或者是反著做。特別感謝 @arsmn! |
-| [helmet](https://github.com/gofiber/helmet) | 透過設定多種 HTTP 標頭,協助保護您應用程式的安全。 |
| [jwt](https://github.com/gofiber/jwt) | JWT 回傳 JSON Web Token \(JWT\) 認證中介模組。 |
-| [keyauth](https://github.com/gofiber/keyauth) | Key auth 中介模組提供以金鑰為基礎的認證模式。 |
-| [redirect](https://github.com/gofiber/redirect) | 用來重新導向的中介模組。 |
-| [rewrite](https://github.com/gofiber/rewrite) | 重寫 (Rewrite) 中介模組:根據提供規則重寫 URL 路徑,適合用來向後相容,或者是製作更乾淨且更好懂的連結。 |
| [storage](https://github.com/gofiber/storage) | 已經做好,實作 Storage 介面的儲存區驅動模組,設計用來與各種 Fiber 中介模組搭配使用。 |
| [template](https://github.com/gofiber/template) | 本套件包含 8 種樣板引擎,可以和 Fiber `v1.10.x` 一起使用。需要 Go 1.13 或更新版本。 |
| [websocket](https://github.com/gofiber/websocket) | 適用於 Fiber,建基於 Fasthttp 的 WebSocket。支援本機空間 (Locals)! |
@@ -695,7 +710,6 @@ Fiber 是個仰賴捐款的開放原始碼專案——用來支付如域名、Gi
- [runewidth](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
- [fasthttp](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
-- [dictpool](https://github.com/savsgio/dictpool/blob/master/LICENSE)
- [fwd](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
- [go-ole](https://github.com/go-ole/go-ole/blob/master/LICENSE)
- [gopsutil](https://github.com/shirou/gopsutil/blob/master/LICENSE)
diff --git a/.github/SECURITY.md b/.github/SECURITY.md
index 30d08a5cf0..9d4826fe02 100644
--- a/.github/SECURITY.md
+++ b/.github/SECURITY.md
@@ -20,7 +20,7 @@ The table below shows the supported versions for Fiber which include security up
**DO NOT CREATE AN ISSUE** to report a security problem. Instead, please
send us an e-mail at `team@gofiber.io` or join our discord server via
-[this invite link](https://discord.gg/bSnH7db) and send a private message
+[this invite link](https://gofiber.io/discord) and send a private message
to Fenny or any of the maintainers.
diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 0000000000..ea3e61d5ba
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,20 @@
+version: v1
+labels:
+ - label: '📒 Documentation'
+ matcher:
+ title: '\b(docs|doc:|\[doc\]|README|typos|comment|documentation)\b'
+ - label: '☢️ Bug'
+ matcher:
+ title: '\b(fix|race|bug|missing|correct)\b'
+ - label: '🧹 Updates'
+ matcher:
+ title: '\b(improve|update|refactor|deprecated|remove|unused|test)\b'
+ - label: '🤖 Dependencies'
+ matcher:
+ title: '\b(bumb|bdependencies)\b'
+ - label: '✏️ Feature'
+ matcher:
+ title: '\b(feature|feat|create|implement|add)\b'
+ - label: '🤔 Question'
+ matcher:
+ title: '\b(question|how)\b'
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 5c34c3748c..8d259296da 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -19,7 +19,7 @@ Please delete options that are not relevant.
- [ ] For new functionalities I follow the inspiration of the express js framework and built them similar in usage
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
-- [ ] I have made corresponding changes to the documentation - https://github.com/gofiber/docs for https://docs.gofiber.io/
+- [ ] I have made corresponding changes to the documentation - /docs/ directory for https://docs.gofiber.io/
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] If new dependencies exist, I have checked that they are really necessary and agreed with the maintainers/community (we want to have as few dependencies as possible)
diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
index 6df748953c..134447d7bc 100644
--- a/.github/release-drafter.yml
+++ b/.github/release-drafter.yml
@@ -32,61 +32,6 @@ version-resolver:
- '🤖 Dependencies'
- '🧹 Updates'
default: patch
-autolabeler:
- - label: '📒 Documentation'
- title:
- - '/docs/i'
- - '/doc:/i'
- - '/\[doc\]/i'
- - '/README/i'
- - '/typos/i'
- - '/comment/i'
- - '/📚/i'
- - '/📒/i'
- - '/📝/i'
- - '/documentation/i'
- - label: '☢️ Bug'
- title:
- - '/fix/i'
- - '/race/i'
- - '/bug/i'
- - '/missing/i'
- - '/correct/i'
- - '/🐛/i'
- - '/☢/i'
- - '/🩹/i'
- - '/🚨/i'
- - label: '🧹 Updates'
- title:
- - '/improve/i'
- - '/update/i'
- - '/refactor/i'
- - '/deprecated/i'
- - '/remove/i'
- - '/unused/i'
- - '/test/i'
- - '/⚡/i'
- - '/👷/i'
- - '/🚧/i'
- - '/♻️/i'
- - '/🎨/i'
- - '/🧪/i'
- - '/🧹/i'
- - label: '🤖 Dependencies'
- title:
- - '/bumb/i'
- - '/dependencies/i'
- - '/📦/i'
- - '/🤖/i'
- - label: '✏️ Feature'
- title:
- - '/feature/i'
- - '/create/i'
- - '/implement/i'
- - '/add/i'
- - '/🚀/i'
- - '/✨/i'
- - '/🔥/i'
template: |
$CHANGES
diff --git a/.github/scripts/sync_docs.sh b/.github/scripts/sync_docs.sh
new file mode 100755
index 0000000000..4b58a1e128
--- /dev/null
+++ b/.github/scripts/sync_docs.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env bash
+
+# Some env variables
+BRANCH="master"
+REPO_URL="github.com/gofiber/docs.git"
+AUTHOR_EMAIL="github-actions[bot]@users.noreply.github.com"
+AUTHOR_USERNAME="github-actions[bot]"
+VERSION_FILE="versions.json"
+REPO_DIR="core"
+COMMIT_URL="https://github.com/gofiber/fiber"
+DOCUSAURUS_COMMAND="npm run docusaurus -- docs:version"
+
+# Set commit author
+git config --global user.email "${AUTHOR_EMAIL}"
+git config --global user.name "${AUTHOR_USERNAME}"
+
+git clone https://${TOKEN}@${REPO_URL} fiber-docs
+
+# Handle push event
+if [ "$EVENT" == "push" ]; then
+ latest_commit=$(git rev-parse --short HEAD)
+ log_output=$(git log --oneline ${BRANCH} HEAD~1..HEAD --name-status -- docs/)
+ if [[ $log_output != "" ]]; then
+ cp -a docs/* fiber-docs/docs/${REPO_DIR}
+ fi
+
+# Handle release event
+elif [ "$EVENT" == "release" ]; then
+ major_version="${TAG_NAME%%.*}"
+
+ # Form new version name
+ new_version="${major_version}.x"
+
+ cd fiber-docs/ || true
+ npm ci
+
+ # Check if contrib_versions.json exists and modify it if required
+ if [[ -f $VERSION_FILE ]]; then
+ jq --arg new_version "$new_version" 'del(.[] | select(. == $new_version))' $VERSION_FILE >temp.json && mv temp.json $VERSION_FILE
+ jq -S . ${VERSION_FILE} >temp.json && mv temp.json ${VERSION_FILE}
+ fi
+
+ # Run docusaurus versioning command
+ $DOCUSAURUS_COMMAND "${new_version}"
+fi
+
+# Push changes
+cd fiber-docs/ || true
+git add .
+if [[ $EVENT == "push" ]]; then
+ git commit -m "Add docs from ${COMMIT_URL}/commit/${latest_commit}"
+elif [[ $EVENT == "release" ]]; then
+ git commit -m "Sync docs for release ${COMMIT_URL}/releases/tag/${TAG_NAME}"
+fi
+
+MAX_RETRIES=5
+DELAY=5
+retry=0
+
+while ((retry < MAX_RETRIES)); do
+ git push https://${TOKEN}@${REPO_URL} && break
+ retry=$((retry + 1))
+ git pull --rebase
+ sleep $DELAY
+done
+
+if ((retry == MAX_RETRIES)); then
+ echo "Failed to push after $MAX_RETRIES attempts. Exiting with 1."
+ exit 1
+fi
diff --git a/.github/workflows/auto-labeler.yml b/.github/workflows/auto-labeler.yml
new file mode 100644
index 0000000000..ef7299117e
--- /dev/null
+++ b/.github/workflows/auto-labeler.yml
@@ -0,0 +1,21 @@
+name: Auto labeler
+on:
+ issues:
+ types: [ opened, edited, milestoned ]
+ pull_request_target:
+ types: [ opened ]
+permissions:
+ contents: read
+ issues: write
+ pull-requests: write
+ statuses: write
+ checks: write
+jobs:
+ labeler:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check Labels
+ id: labeler
+ uses: fuxingloh/multi-labeler@v2
+ with:
+ github-token: ${{secrets.GITHUB_TOKEN}}
diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml
index 9d1fc3f6a2..a751eae918 100644
--- a/.github/workflows/benchmark.yml
+++ b/.github/workflows/benchmark.yml
@@ -1,11 +1,24 @@
-on: [push]
+on:
+ push:
+ branches:
+ - master
+ - main
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!**.md'
+ pull_request:
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!**.md'
name: Benchmark
jobs:
Compare:
runs-on: ubuntu-latest
steps:
- name: Install Go
- uses: actions/setup-go@v3
+ uses: actions/setup-go@v4
with:
go-version: 1.20.x
- name: Fetch Repository
@@ -19,13 +32,17 @@ jobs:
# TODO: reactivate it later -> when v3 is the stable one
key: ${{ runner.os }}-benchmark-v3
- name: Save Benchmark Results
- uses: rhysd/github-action-benchmark@v1
+ uses: benchmark-action/github-action-benchmark@v1.16.2
with:
tool: 'go'
output-file-path: output.txt
github-token: ${{ secrets.BENCHMARK_TOKEN }}
benchmark-data-dir-path: 'benchmarks'
fail-on-alert: true
- comment-on-alert: true
+ comment-on-alert: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
+ # Enable Job Summary for PRs - deactivated because of issues
+ #summary-always: ${{ github.event_name != 'push' && github.event_name != 'workflow_dispatch' }}
# TODO: reactivate it later -> when v3 is the stable one
+ #auto-push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
auto-push: false
+ save-data-file: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 54aa7ba8d4..e95e715d50 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -2,10 +2,19 @@ name: "CodeQL"
on:
push:
- branches: [v3-beta, ]
+ branches:
+ - master
+ - main
+ - v3-beta
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!**.md'
pull_request:
- # The branches below must be a subset of the branches above
- branches: [v3-beta]
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!**.md'
schedule:
- cron: '0 3 * * 6'
diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml
index db9a2bb8e5..fa43748571 100644
--- a/.github/workflows/linter.yml
+++ b/.github/workflows/linter.yml
@@ -3,8 +3,6 @@
name: golangci-lint
on:
push:
- tags:
- - v*
branches:
#- master
#- main
@@ -17,11 +15,11 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- - uses: actions/setup-go@v3
+ - uses: actions/checkout@v3
+ - uses: actions/setup-go@v4
with:
# NOTE: Keep this in sync with the version from go.mod
go-version: 1.20.x
- - uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml
index 1669279191..f4a5cea982 100644
--- a/.github/workflows/release-drafter.yml
+++ b/.github/workflows/release-drafter.yml
@@ -5,10 +5,7 @@ on:
# branches to consider in the event; optional, defaults to all
branches:
- master
- # pull_request event is required only for autolabeler
- pull_request:
- # Only following types are handled by the action, but one can default to all as well
- types: [opened, reopened, synchronize]
+ - main
jobs:
update_release_draft:
diff --git a/.github/workflows/sync-docs.yml b/.github/workflows/sync-docs.yml
new file mode 100644
index 0000000000..c7f895de6a
--- /dev/null
+++ b/.github/workflows/sync-docs.yml
@@ -0,0 +1,35 @@
+name: 'Sync docs'
+
+on:
+ push:
+ branches:
+ - master
+ - main
+ paths:
+ - 'docs/**'
+ release:
+ types: [ published ]
+
+jobs:
+ sync-docs:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ ref: ${{ github.event.pull_request.head.sha }}
+ fetch-depth: 2
+ - name: Setup Node.js environment
+ uses: actions/setup-node@v3
+ with:
+ node-version: '18'
+
+ - name: Install JQ
+ run: sudo apt-get install jq
+
+ - name: Sync docs
+ run: ./.github/scripts/sync_docs.sh
+ env:
+ EVENT: ${{ github.event_name }}
+ TAG_NAME: ${{ github.ref_name }}
+ TOKEN: ${{ secrets.DOC_SYNC_TOKEN }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 99adde703d..da1c72d31a 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,8 +1,18 @@
on:
push:
branches:
+ - master
+ - main
- v3-beta
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!**.md'
pull_request:
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!**.md'
name: Test
jobs:
Build:
@@ -12,31 +22,15 @@ jobs:
platform: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
+ - name: Fetch Repository
+ uses: actions/checkout@v3
- name: Install Go
- uses: actions/setup-go@v3
+ uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- - name: Setup Golang caches
- uses: actions/cache@v3
- with:
- # In order:
- # * Module download cache
- # * Build cache (Linux)
- # * Build cache (Mac)
- # * Build cache (Windows)
- path: |
- ~/go/pkg/mod
- ~/.cache/go-build
- ~/Library/Caches/go-build
- ~\AppData\Local\go-build
- key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
- restore-keys: |
- ${{ runner.os }}-go-${{ matrix.go-version }}-
- - name: Fetch Repository
- uses: actions/checkout@v3
- name: Run Test
uses: nick-fields/retry@v2
with:
max_attempts: 3
timeout_minutes: 15
- command: go test ./... -v -race
+ command: go test ./... -v -race -count=1
diff --git a/.github/workflows/vulncheck.yml b/.github/workflows/vulncheck.yml
index 06477dccbb..4c13423020 100644
--- a/.github/workflows/vulncheck.yml
+++ b/.github/workflows/vulncheck.yml
@@ -1,26 +1,35 @@
+name: Run govulncheck
+
on:
push:
branches:
- master
- main
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!**.md'
pull_request:
-name: Vulnerability Check
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!**.md'
+
jobs:
- Security:
+ govulncheck-check:
runs-on: ubuntu-latest
+ env:
+ GO111MODULE: on
steps:
+ - name: Fetch Repository
+ uses: actions/checkout@v3
- name: Install Go
- uses: actions/setup-go@v3
+ uses: actions/setup-go@v4
with:
- go-version: 1.20.x
+ go-version: 'stable'
check-latest: true
- - name: Fetch Repository
- uses: actions/checkout@v3
+ cache: false
- name: Install Govulncheck
- run: |
- export GO111MODULE=on
- export PATH=${PATH}:`go env GOPATH`/bin
- go install golang.org/x/vuln/cmd/govulncheck@latest
+ run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run Govulncheck
- run: "`go env GOPATH`/bin/govulncheck ./..."
-
+ run: govulncheck ./...
\ No newline at end of file
diff --git a/app.go b/app.go
index 552b994028..78b03af5bd 100644
--- a/app.go
+++ b/app.go
@@ -14,7 +14,6 @@ import (
"encoding/xml"
"errors"
"fmt"
- "log"
"net"
"net/http"
"net/http/httputil"
@@ -24,7 +23,9 @@ import (
"sync"
"time"
+ "github.com/gofiber/fiber/v2/log"
"github.com/gofiber/utils/v2"
+
"github.com/valyala/fasthttp"
)
@@ -565,7 +566,7 @@ func (app *App) handleTrustedProxy(ipAddress string) {
if strings.Contains(ipAddress, "/") {
_, ipNet, err := net.ParseCIDR(ipAddress)
if err != nil {
- log.Printf("[Warning] IP range %q could not be parsed: %v\n", ipAddress, err)
+ log.Warnf("IP range %q could not be parsed: %v", ipAddress, err)
} else {
app.config.trustedProxyRanges = append(app.config.trustedProxyRanges, ipNet)
}
@@ -597,18 +598,23 @@ func (app *App) SetTLSHandler(tlsHandler *TLSHandler) {
// Name Assign name to specific route.
func (app *App) Name(name string) Router {
app.mutex.Lock()
+ defer app.mutex.Unlock()
- latestGroup := app.latestRoute.group
- if latestGroup != nil {
- app.latestRoute.Name = latestGroup.name + name
- } else {
- app.latestRoute.Name = name
+ for _, routes := range app.stack {
+ for _, route := range routes {
+ if route.Path == app.latestRoute.path {
+ route.Name = name
+
+ if route.group != nil {
+ route.Name = route.group.name + route.Name
+ }
+ }
+ }
}
if err := app.hooks.executeOnNameHooks(*app.latestRoute); err != nil {
panic(err)
}
- app.mutex.Unlock()
return app
}
@@ -757,12 +763,16 @@ func (app *App) Patch(path string, handler Handler, middleware ...Handler) Route
// Add allows you to specify multiple HTTP methods to register a route.
func (app *App) Add(methods []string, path string, handler Handler, middleware ...Handler) Router {
- return app.register(methods, path, nil, handler, middleware...)
+ app.register(methods, path, nil, handler, middleware...)
+
+ return app
}
// Static will create a file server serving static files
func (app *App) Static(prefix, root string, config ...Static) Router {
- return app.registerStatic(prefix, root, config...)
+ app.registerStatic(prefix, root, config...)
+
+ return app
}
// All will register the handler on all HTTP methods
@@ -841,7 +851,7 @@ func (app *App) HandlersCount() uint32 {
//
// Shutdown does not close keepalive connections so its recommended to set ReadTimeout to something else than 0.
func (app *App) Shutdown() error {
- return app.shutdownWithContext(context.Background())
+ return app.ShutdownWithContext(context.Background())
}
// ShutdownWithTimeout gracefully shuts down the server without interrupting any active connections. However, if the timeout is exceeded,
@@ -854,11 +864,15 @@ func (app *App) Shutdown() error {
func (app *App) ShutdownWithTimeout(timeout time.Duration) error {
ctx, cancelFunc := context.WithTimeout(context.Background(), timeout)
defer cancelFunc()
- return app.shutdownWithContext(ctx)
+ return app.ShutdownWithContext(ctx)
}
-// shutdownWithContext shuts down the server including by force if the context's deadline is exceeded.
-func (app *App) shutdownWithContext(ctx context.Context) error {
+// ShutdownWithContext shuts down the server including by force if the context's deadline is exceeded.
+//
+// Make sure the program doesn't exit and waits instead for ShutdownWithTimeout to return.
+//
+// ShutdownWithContext does not close keepalive connections so its recommended to set ReadTimeout to something else than 0.
+func (app *App) ShutdownWithContext(ctx context.Context) error {
if app.hooks != nil {
// TODO: check should be defered?
app.hooks.executeOnShutdownHooks()
@@ -884,11 +898,11 @@ func (app *App) Hooks() *Hooks {
// Test is used for internal debugging by passing a *http.Request.
// Timeout is optional and defaults to 1s, -1 will disable it completely.
-func (app *App) Test(req *http.Request, timeout ...time.Duration) (*http.Response, error) {
+func (app *App) Test(req *http.Request, msTimeout ...int) (*http.Response, error) {
// Set timeout
- to := 1 * time.Second
- if len(timeout) > 0 {
- to = timeout[0]
+ timeout := 1000
+ if len(msTimeout) > 0 {
+ timeout = msTimeout[0]
}
// Add Content-Length if not provided with body
@@ -927,12 +941,12 @@ func (app *App) Test(req *http.Request, timeout ...time.Duration) (*http.Respons
}()
// Wait for callback
- if to >= 0 {
+ if timeout >= 0 {
// With timeout
select {
case err = <-channel:
- case <-time.After(to):
- return nil, fmt.Errorf("test: timeout error after %s", to)
+ case <-time.After(time.Duration(timeout) * time.Millisecond):
+ return nil, fmt.Errorf("test: timeout error %vms", timeout)
}
} else {
// Without timeout
@@ -969,7 +983,7 @@ func (app *App) init() *App {
// Only load templates if a view engine is specified
if app.config.Views != nil {
if err := app.config.Views.Load(); err != nil {
- log.Printf("[Warning]: failed to load views: %v\n", err)
+ log.Warnf("failed to load views: %v", err)
}
}
@@ -1049,13 +1063,18 @@ func (app *App) serverErrorHandler(fctx *fasthttp.RequestCtx, err error) {
defer app.ReleaseCtx(c)
- var errNetOP *net.OpError
+ var (
+ errNetOP *net.OpError
+ netErr net.Error
+ )
switch {
case errors.As(err, new(*fasthttp.ErrSmallBuffer)):
err = ErrRequestHeaderFieldsTooLarge
case errors.As(err, &errNetOP) && errNetOP.Timeout():
err = ErrRequestTimeout
+ case errors.As(err, &netErr):
+ err = ErrBadGateway
case errors.Is(err, fasthttp.ErrBodyTooLarge):
err = ErrRequestEntityTooLarge
case errors.Is(err, fasthttp.ErrGetOnly):
@@ -1067,7 +1086,7 @@ func (app *App) serverErrorHandler(fctx *fasthttp.RequestCtx, err error) {
}
if catch := app.ErrorHandler(c, err); catch != nil {
- log.Printf("serverErrorHandler: failed to call ErrorHandler: %v\n", catch)
+ log.Errorf("serverErrorHandler: failed to call ErrorHandler: %v", catch)
_ = c.SendStatus(StatusInternalServerError) //nolint:errcheck // It is fine to ignore the error here
return
}
@@ -1075,22 +1094,20 @@ func (app *App) serverErrorHandler(fctx *fasthttp.RequestCtx, err error) {
// startupProcess Is the method which executes all the necessary processes just before the start of the server.
func (app *App) startupProcess() *App {
- if err := app.hooks.executeOnListenHooks(); err != nil {
- panic(err)
- }
-
app.mutex.Lock()
defer app.mutex.Unlock()
- // add routes of sub-apps
- app.mountFields.subAppsRoutesAdded.Do(func() {
- app.appendSubAppLists(app.mountFields.appList)
- app.addSubAppsRoutes(app.mountFields.appList)
- app.generateAppListKeys()
- })
+ app.mountStartupProcess()
// build route tree stack
app.buildTree()
return app
}
+
+// Run onListen hooks. If they return an error, panic.
+func (app *App) runOnListenHooks(listenData ListenData) {
+ if err := app.hooks.executeOnListenHooks(listenData); err != nil {
+ panic(err)
+ }
+}
diff --git a/app_test.go b/app_test.go
index e7b3bcef4b..c50df64ae0 100644
--- a/app_test.go
+++ b/app_test.go
@@ -23,6 +23,8 @@ import (
"testing"
"time"
+ "github.com/gofiber/utils/v2"
+
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
"github.com/valyala/fasthttp/fasthttputil"
@@ -249,7 +251,7 @@ func Test_App_ErrorHandler_RouteStack(t *testing.T) {
require.Equal(t, 500, resp.StatusCode, "Status code")
body, err := io.ReadAll(resp.Body)
- require.Equal(t, nil, err)
+ require.NoError(t, err)
require.Equal(t, "1: USE error", string(body))
}
@@ -264,6 +266,20 @@ func Test_App_serverErrorHandler_Internal_Error(t *testing.T) {
require.Equal(t, c.fasthttp.Response.StatusCode(), StatusBadRequest)
}
+func Test_App_serverErrorHandler_Network_Error(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx) //nolint:errcheck, forcetypeassert // not needed
+
+ app.serverErrorHandler(c.fasthttp, &net.DNSError{
+ Err: "test error",
+ Name: "test host",
+ IsTimeout: false,
+ })
+ require.Equal(t, string(c.fasthttp.Response.Body()), utils.StatusMessage(StatusBadGateway))
+ require.Equal(t, c.fasthttp.Response.StatusCode(), StatusBadGateway)
+}
+
func Test_App_Nested_Params(t *testing.T) {
t.Parallel()
app := New()
@@ -785,6 +801,53 @@ func Test_App_ShutdownWithTimeout(t *testing.T) {
}
}
+func Test_App_ShutdownWithContext(t *testing.T) {
+ t.Parallel()
+
+ app := New()
+ app.Get("/", func(ctx Ctx) error {
+ time.Sleep(5 * time.Second)
+ return ctx.SendString("body")
+ })
+
+ ln := fasthttputil.NewInmemoryListener()
+
+ go func() {
+ require.Equal(t, nil, app.Listener(ln))
+ }()
+
+ time.Sleep(1 * time.Second)
+
+ go func() {
+ conn, err := ln.Dial()
+ if err != nil {
+ t.Errorf("unexepcted error: %v", err)
+ }
+
+ if _, err = conn.Write([]byte("GET / HTTP/1.1\r\nHost: google.com\r\n\r\n")); err != nil {
+ t.Errorf("unexpected error: %v", err)
+ }
+ }()
+
+ time.Sleep(1 * time.Second)
+
+ shutdownErr := make(chan error)
+ go func() {
+ ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
+ defer cancel()
+ shutdownErr <- app.ShutdownWithContext(ctx)
+ }()
+
+ select {
+ case <-time.After(5 * time.Second):
+ t.Fatal("idle connections not closed on shutdown")
+ case err := <-shutdownErr:
+ if err == nil || !errors.Is(err, context.DeadlineExceeded) {
+ t.Fatalf("unexpected err %v. Expecting %v", err, context.DeadlineExceeded)
+ }
+ }
+}
+
// go test -run Test_App_Static_Index_Default
func Test_App_Static_Index_Default(t *testing.T) {
app := New()
@@ -1322,7 +1385,7 @@ func Test_Test_Timeout(t *testing.T) {
return nil
})
- _, err = app.Test(httptest.NewRequest(MethodGet, "/timeout", nil), 20*time.Millisecond)
+ _, err = app.Test(httptest.NewRequest(MethodGet, "/timeout", nil), 20)
require.True(t, err != nil, "app.Test(req)")
}
@@ -1534,13 +1597,13 @@ func Test_App_New_Test_Parallel(t *testing.T) {
t.Parallel()
app := New(Config{Immutable: true})
_, err := app.Test(httptest.NewRequest(MethodGet, "/", nil))
- require.Equal(t, nil, err)
+ require.NoError(t, err)
})
t.Run("Test_App_New_Test_Parallel_2", func(t *testing.T) {
t.Parallel()
app := New(Config{Immutable: true})
_, err := app.Test(httptest.NewRequest(MethodGet, "/", nil))
- require.Equal(t, nil, err)
+ require.NoError(t, err)
})
}
@@ -1698,3 +1761,62 @@ func TestApp_GetRoutes(t *testing.T) {
require.Equal(t, name, route.Name)
}
}
+
+func Test_Middleware_Route_Naming_With_Use(t *testing.T) {
+ named := "named"
+ app := New()
+
+ app.Get("/unnamed", func(c Ctx) error {
+ return c.Next()
+ })
+
+ app.Post("/named", func(c Ctx) error {
+ return c.Next()
+ }).Name(named)
+
+ app.Use(func(c Ctx) error {
+ return c.Next()
+ }) // no name - logging MW
+
+ app.Use(func(c Ctx) error {
+ return c.Next()
+ }).Name("corsMW")
+
+ app.Use(func(c Ctx) error {
+ return c.Next()
+ }).Name("compressMW")
+
+ app.Use(func(c Ctx) error {
+ return c.Next()
+ }) // no name - cache MW
+
+ grp := app.Group("/pages").Name("pages.")
+ grp.Use(func(c Ctx) error {
+ return c.Next()
+ }).Name("csrfMW")
+
+ grp.Get("/home", func(c Ctx) error {
+ return c.Next()
+ }).Name("home")
+
+ grp.Get("/unnamed", func(c Ctx) error {
+ return c.Next()
+ })
+
+ for _, route := range app.GetRoutes() {
+ switch route.Path {
+ case "/":
+ require.Equal(t, "compressMW", route.Name)
+ case "/unnamed":
+ require.Equal(t, "", route.Name)
+ case "named":
+ require.Equal(t, named, route.Name)
+ case "/pages":
+ require.Equal(t, "pages.csrfMW", route.Name)
+ case "/pages/home":
+ require.Equal(t, "pages.home", route.Name)
+ case "/pages/unnamed":
+ require.Equal(t, "", route.Name)
+ }
+ }
+}
diff --git a/bind_test.go b/bind_test.go
index d9c9d06aa4..d1a63ce400 100644
--- a/bind_test.go
+++ b/bind_test.go
@@ -1577,7 +1577,7 @@ func Test_Bind_StructValidator(t *testing.T) {
rq := new(simpleQuery)
c.Request().URI().SetQueryString("name=efe")
- require.Equal(t, "you should have entered right name!", c.Bind().Query(rq).Error())
+ require.Equal(t, "you should have entered right name", c.Bind().Query(rq).Error())
rq = new(simpleQuery)
c.Request().URI().SetQueryString("name=john")
diff --git a/client.go b/client.go
index 734f677d3c..4fb177da06 100644
--- a/client.go
+++ b/client.go
@@ -77,50 +77,50 @@ type Client struct {
JSONDecoder utils.JSONUnmarshal
}
-// Get returns a agent with http method GET.
+// Get returns an agent with http method GET.
func Get(url string) *Agent { return defaultClient.Get(url) }
-// Get returns a agent with http method GET.
+// Get returns an agent with http method GET.
func (c *Client) Get(url string) *Agent {
return c.createAgent(MethodGet, url)
}
-// Head returns a agent with http method HEAD.
+// Head returns an agent with http method HEAD.
func Head(url string) *Agent { return defaultClient.Head(url) }
-// Head returns a agent with http method GET.
+// Head returns an agent with http method GET.
func (c *Client) Head(url string) *Agent {
return c.createAgent(MethodHead, url)
}
-// Post sends POST request to the given url.
+// Post sends POST request to the given URL.
func Post(url string) *Agent { return defaultClient.Post(url) }
-// Post sends POST request to the given url.
+// Post sends POST request to the given URL.
func (c *Client) Post(url string) *Agent {
return c.createAgent(MethodPost, url)
}
-// Put sends PUT request to the given url.
+// Put sends PUT request to the given URL.
func Put(url string) *Agent { return defaultClient.Put(url) }
-// Put sends PUT request to the given url.
+// Put sends PUT request to the given URL.
func (c *Client) Put(url string) *Agent {
return c.createAgent(MethodPut, url)
}
-// Patch sends PATCH request to the given url.
+// Patch sends PATCH request to the given URL.
func Patch(url string) *Agent { return defaultClient.Patch(url) }
-// Patch sends PATCH request to the given url.
+// Patch sends PATCH request to the given URL.
func (c *Client) Patch(url string) *Agent {
return c.createAgent(MethodPatch, url)
}
-// Delete sends DELETE request to the given url.
+// Delete sends DELETE request to the given URL.
func Delete(url string) *Agent { return defaultClient.Delete(url) }
-// Delete sends DELETE request to the given url.
+// Delete sends DELETE request to the given URL.
func (c *Client) Delete(url string) *Agent {
return c.createAgent(MethodDelete, url)
}
@@ -379,7 +379,7 @@ func (a *Agent) ContentTypeBytes(contentType []byte) *Agent {
/************************** URI Setting **************************/
-// Host sets host for the uri.
+// Host sets host for the URI.
func (a *Agent) Host(host string) *Agent {
a.req.URI().SetHost(host)
@@ -800,7 +800,7 @@ func (a *Agent) String() (int, string, []error) {
return code, utils.UnsafeString(body), errs
}
-// Struct returns the status code, bytes body and errors of url.
+// Struct returns the status code, bytes body and errors of URL.
// And bytes body will be unmarshalled to given v.
//
// it's not safe to use Agent after calling [Agent.Struct]
@@ -888,7 +888,7 @@ func AcquireClient() *Client {
// ReleaseClient returns c acquired via AcquireClient to client pool.
//
-// It is forbidden accessing req and/or its' members after returning
+// It is forbidden accessing req and/or it's members after returning
// it to client pool.
func ReleaseClient(c *Client) {
c.UserAgent = ""
@@ -912,9 +912,9 @@ func AcquireAgent() *Agent {
return a
}
-// ReleaseAgent returns a acquired via AcquireAgent to Agent pool.
+// ReleaseAgent returns an acquired via AcquireAgent to Agent pool.
//
-// It is forbidden accessing req and/or its' members after returning
+// It is forbidden accessing req and/or it's members after returning
// it to Agent pool.
func ReleaseAgent(a *Agent) {
a.reset()
@@ -941,7 +941,7 @@ func AcquireResponse() *Response {
// ReleaseResponse return resp acquired via AcquireResponse to response pool.
//
-// It is forbidden accessing resp and/or its' members after returning
+// It is forbidden accessing resp and/or it's members after returning
// it to response pool.
// Copy from fasthttp
func ReleaseResponse(resp *Response) {
diff --git a/client_test.go b/client_test.go
index 97a7696d7d..916846bedf 100644
--- a/client_test.go
+++ b/client_test.go
@@ -647,6 +647,14 @@ func (*readErrorConn) RemoteAddr() net.Addr {
return nil
}
+func (*readErrorConn) SetReadDeadline(_ time.Time) error {
+ return nil
+}
+
+func (*readErrorConn) SetWriteDeadline(_ time.Time) error {
+ return nil
+}
+
func Test_Client_Agent_RetryIf(t *testing.T) {
t.Parallel()
diff --git a/ctx.go b/ctx.go
index 32f56d0b0c..9eec222191 100644
--- a/ctx.go
+++ b/ctx.go
@@ -103,73 +103,22 @@ type Views interface {
// Accepts checks if the specified extensions or content types are acceptable.
func (c *DefaultCtx) Accepts(offers ...string) string {
- if len(offers) == 0 {
- return ""
- }
- header := c.Get(HeaderAccept)
- if header == "" {
- return offers[0]
- }
-
- spec, commaPos := "", 0
- for len(header) > 0 && commaPos != -1 {
- commaPos = strings.IndexByte(header, ',')
- if commaPos != -1 {
- spec = strings.TrimLeft(header[:commaPos], " ")
- } else {
- spec = strings.TrimLeft(header, " ")
- }
- if factorSign := strings.IndexByte(spec, ';'); factorSign != -1 {
- spec = spec[:factorSign]
- }
-
- var mimetype string
- for _, offer := range offers {
- if len(offer) == 0 {
- continue
- // Accept: */*
- } else if spec == "*/*" {
- return offer
- }
-
- if strings.IndexByte(offer, '/') != -1 {
- mimetype = offer // MIME type
- } else {
- mimetype = utils.GetMIME(offer) // extension
- }
-
- if spec == mimetype {
- // Accept: Hello, World!
", string(c.Response().Body()))
+ require.Equal(t, "Hello from Fiber!
", string(c.Response().Body()))
}
func Test_Ctx_RenderWithBindVarsLocals(t *testing.T) {
@@ -3474,16 +3529,16 @@ func TestCtx_ParamsInt(t *testing.T) {
})
_, err := app.Test(httptest.NewRequest(MethodGet, "/test/1111", nil))
- require.Equal(t, nil, err)
+ require.NoError(t, err)
_, err = app.Test(httptest.NewRequest(MethodGet, "/testnoint/xd", nil))
- require.Equal(t, nil, err)
+ require.NoError(t, err)
_, err = app.Test(httptest.NewRequest(MethodGet, "/testignoredefault/2222", nil))
- require.Equal(t, nil, err)
+ require.NoError(t, err)
_, err = app.Test(httptest.NewRequest(MethodGet, "/testdefault/xd", nil))
- require.Equal(t, nil, err)
+ require.NoError(t, err)
}
// go test -run Test_Ctx_GetRespHeader
diff --git a/docs/api/_category_.json b/docs/api/_category_.json
new file mode 100644
index 0000000000..c0fc66388a
--- /dev/null
+++ b/docs/api/_category_.json
@@ -0,0 +1,8 @@
+{
+ "label": "API",
+ "position": 2,
+ "link": {
+ "type": "generated-index",
+ "description": "API documentation for Fiber."
+ }
+}
diff --git a/docs/api/app.md b/docs/api/app.md
new file mode 100644
index 0000000000..5f788ca356
--- /dev/null
+++ b/docs/api/app.md
@@ -0,0 +1,657 @@
+---
+id: app
+title: 🚀 App
+description: The app instance conventionally denotes the Fiber application.
+sidebar_position: 2
+---
+
+import RoutingHandler from './../partials/routing/handler.md';
+
+## Static
+
+Use the **Static** method to serve static files such as **images**, **CSS,** and **JavaScript**.
+
+:::info
+By default, **Static** will serve `index.html` files in response to a request on a directory.
+:::
+
+```go title="Signature"
+func (app *App) Static(prefix, root string, config ...Static) Router
+```
+
+Use the following code to serve files in a directory named `./public`
+
+```go
+app.Static("/", "./public")
+
+// => http://localhost:3000/hello.html
+// => http://localhost:3000/js/jquery.js
+// => http://localhost:3000/css/style.css
+```
+
+```go title="Examples"
+// Serve files from multiple directories
+app.Static("/", "./public")
+
+// Serve files from "./files" directory:
+app.Static("/", "./files")
+```
+
+You can use any virtual path prefix \(_where the path does not actually exist in the file system_\) for files that are served by the **Static** method, specify a prefix path for the static directory, as shown below:
+
+```go title="Examples"
+app.Static("/static", "./public")
+
+// => http://localhost:3000/static/hello.html
+// => http://localhost:3000/static/js/jquery.js
+// => http://localhost:3000/static/css/style.css
+```
+
+If you want to have a little bit more control regarding the settings for serving static files. You could use the `fiber.Static` struct to enable specific settings.
+
+```go title="fiber.Static{}"
+// Static defines configuration options when defining static assets.
+type Static struct {
+ // When set to true, the server tries minimizing CPU usage by caching compressed files.
+ // This works differently than the github.com/gofiber/compression middleware.
+ // Optional. Default value false
+ Compress bool `json:"compress"`
+
+ // When set to true, enables byte range requests.
+ // Optional. Default value false
+ ByteRange bool `json:"byte_range"`
+
+ // When set to true, enables directory browsing.
+ // Optional. Default value false.
+ Browse bool `json:"browse"`
+
+ // When set to true, enables direct download.
+ // Optional. Default value false.
+ Download bool `json:"download"`
+
+ // The name of the index file for serving a directory.
+ // Optional. Default value "index.html".
+ Index string `json:"index"`
+
+ // Expiration duration for inactive file handlers.
+ // Use a negative time.Duration to disable it.
+ //
+ // Optional. Default value 10 * time.Second.
+ CacheDuration time.Duration `json:"cache_duration"`
+
+ // The value for the Cache-Control HTTP-header
+ // that is set on the file response. MaxAge is defined in seconds.
+ //
+ // Optional. Default value 0.
+ MaxAge int `json:"max_age"`
+
+ // ModifyResponse defines a function that allows you to alter the response.
+ //
+ // Optional. Default: nil
+ ModifyResponse Handler
+
+ // Next defines a function to skip this middleware when returned true.
+ //
+ // Optional. Default: nil
+ Next func(c *Ctx) bool
+}
+```
+
+```go title="Example"
+// Custom config
+app.Static("/", "./public", fiber.Static{
+ Compress: true,
+ ByteRange: true,
+ Browse: true,
+ Index: "john.html",
+ CacheDuration: 10 * time.Second,
+ MaxAge: 3600,
+})
+```
+
+## Route Handlers
+
+
**WARNING:** There is a small performance cost to doing this validation. Keep disabled if speed is your only concern and your application is behind a trusted proxy that already validates this header. | `false` |
+| EnablePrintRoutes | `bool` | EnablePrintRoutes enables print all routes with their method, path, name and handler.. | `false` |
+| EnableTrustedProxyCheck | `bool` | When set to true, fiber will check whether proxy is trusted, using TrustedProxies list.
By default `c.Protocol()` will get value from X-Forwarded-Proto, X-Forwarded-Protocol, X-Forwarded-Ssl or X-Url-Scheme header, `c.IP()` will get value from `ProxyHeader` header, `c.Hostname()` will get value from X-Forwarded-Host header.
If `EnableTrustedProxyCheck` is true, and `RemoteIP` is in the list of `TrustedProxies` `c.Protocol()`, `c.IP()`, and `c.Hostname()` will have the same behaviour when `EnableTrustedProxyCheck` disabled, if `RemoteIP` isn't in the list, `c.Protocol()` will return https in case when tls connection is handled by the app, or http otherwise, `c.IP()` will return RemoteIP() from fasthttp context, `c.Hostname()` will return `fasthttp.Request.URI().Host()` | `false` |
+| ErrorHandler | `ErrorHandler` | ErrorHandler is executed when an error is returned from fiber.Handler. Mounted fiber error handlers are retained by the top-level app and applied on prefix associated requests. | `DefaultErrorHandler` |
+| GETOnly | `bool` | Rejects all non-GET requests if set to true. This option is useful as anti-DoS protection for servers accepting only GET requests. The request size is limited by ReadBufferSize if GETOnly is set. | `false` |
+| IdleTimeout | `time.Duration` | The maximum amount of time to wait for the next request when keep-alive is enabled. If IdleTimeout is zero, the value of ReadTimeout is used. | `nil` |
+| Immutable | `bool` | When enabled, all values returned by context methods are immutable. By default, they are valid until you return from the handler; see issue [\#185](https://github.com/gofiber/fiber/issues/185). | `false` |
+| JSONDecoder | `utils.JSONUnmarshal` | Allowing for flexibility in using another json library for decoding. | `json.Unmarshal` |
+| JSONEncoder | `utils.JSONMarshal` | Allowing for flexibility in using another json library for encoding. | `json.Marshal` |
+| Network | `string` | Known networks are "tcp", "tcp4" (IPv4-only), "tcp6" (IPv6-only)
**WARNING:** When prefork is set to true, only "tcp4" and "tcp6" can be chosen. | `NetworkTCP4` |
+| PassLocalsToViews | `bool` | PassLocalsToViews Enables passing of the locals set on a fiber.Ctx to the template engine. See our **Template Middleware** for supported engines. | `false` |
+| Prefork | `bool` | Enables use of the[`SO_REUSEPORT`](https://lwn.net/Articles/542629/)socket option. This will spawn multiple Go processes listening on the same port. learn more about [socket sharding](https://www.nginx.com/blog/socket-sharding-nginx-release-1-9-1/). **NOTE: if enabled, the application will need to be ran through a shell because prefork mode sets environment variables. If you're using Docker, make sure the app is ran with `CMD ./app` or `CMD ["sh", "-c", "/app"]`. For more info, see** [**this**](https://github.com/gofiber/fiber/issues/1021#issuecomment-730537971) **issue comment.** | `false` |
+| ProxyHeader | `string` | This will enable `c.IP()` to return the value of the given header key. By default `c.IP()`will return the Remote IP from the TCP connection, this property can be useful if you are behind a load balancer e.g. _X-Forwarded-\*_. | `""` |
+| ReadBufferSize | `int` | per-connection buffer size for requests' reading. This also limits the maximum header size. Increase this buffer if your clients send multi-KB RequestURIs and/or multi-KB headers \(for example, BIG cookies\). | `4096` |
+| ReadTimeout | `time.Duration` | The amount of time allowed to read the full request, including the body. The default timeout is unlimited. | `nil` |
+| RequestMethods | `[]string` | RequestMethods provides customizibility for HTTP methods. You can add/remove methods as you wish. | `DefaultMethods` |
+| ServerHeader | `string` | Enables the `Server` HTTP header with the given value. | `""` |
+| StreamRequestBody | `bool` | StreamRequestBody enables request body streaming, and calls the handler sooner when given body is larger then the current limit. | `false` |
+| StrictRouting | `bool` | When enabled, the router treats `/foo` and `/foo/` as different. Otherwise, the router treats `/foo` and `/foo/` as the same. | `false` |
+| TrustedProxies | `[]string` | Contains the list of trusted proxy IP's. Look at `EnableTrustedProxyCheck` doc.
It can take IP or IP range addresses. If it gets IP range, it iterates all possible addresses. | `[]string*__*` |
+| UnescapePath | `bool` | Converts all encoded characters in the route back before setting the path for the context, so that the routing can also work with URL encoded special characters | `false` |
+| Views | `Views` | Views is the interface that wraps the Render function. See our **Template Middleware** for supported engines. | `nil` |
+| ViewsLayout | `string` | Views Layout is the global layout for all template render until override on Render function. See our **Template Middleware** for supported engines. | `""` |
+| WriteBufferSize | `int` | Per-connection buffer size for responses' writing. | `4096` |
+| WriteTimeout | `time.Duration` | The maximum duration before timing out writes of the response. The default timeout is unlimited. | `nil` |
+| XMLEncoder | `utils.XMLMarshal` | Allowing for flexibility in using another XML library for encoding. | `xml.Marshal` |
+
+## NewError
+
+NewError creates a new HTTPError instance with an optional message.
+
+```go title="Signature"
+func NewError(code int, message ...string) *Error
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ return fiber.NewError(782, "Custom error message")
+})
+```
+
+## IsChild
+
+IsChild determines if the current process is a result of Prefork.
+
+```go title="Signature"
+func IsChild() bool
+```
+
+```go title="Example"
+// Prefork will spawn child processes
+app := fiber.New(fiber.Config{
+ Prefork: true,
+})
+
+if !fiber.IsChild() {
+ fmt.Println("I'm the parent process")
+} else {
+ fmt.Println("I'm a child process")
+}
+
+// ...
+```
diff --git a/docs/api/log.md b/docs/api/log.md
new file mode 100644
index 0000000000..9b741b13f7
--- /dev/null
+++ b/docs/api/log.md
@@ -0,0 +1,155 @@
+---
+id: log
+title: 📃 Log
+description: Fiber's built-in log package
+sidebar_position: 6
+---
+
+We can use logs to observe program behavior, diagnose problems, or configure corresponding alarms.
+And defining a well structured log can improve search efficiency and facilitate handling of problems.
+
+Fiber provides a default way to print logs in the standard output.
+It also provides several global functions, such as `log.Info`, `log.Errorf`, `log.Warnw`, etc.
+
+## Log levels
+
+```go
+const (
+ LevelTrace Level = iota
+ LevelDebug
+ LevelInfo
+ LevelWarn
+ LevelError
+ LevelFatal
+ LevelPanic
+)
+```
+
+## Custom log
+
+Fiber provides the `AllLogger` interface for adapting the various log libraries.
+
+```go
+type CommonLogger interface {
+ Logger
+ FormatLogger
+ WithLogger
+}
+
+type AllLogger interface {
+ CommonLogger
+ ControlLogger
+ WithLogger
+}
+```
+
+## Print log
+Note: The method of calling the Fatal level will interrupt the program running after printing the log, please use it with caution.
+Directly print logs of different levels, which will be entered into messageKey, the default is msg.
+
+```go
+log.Info("Hello, World!")
+log.Debug("Are you OK?")
+log.Info("42 is the answer to life, the universe, and everything")
+log.Warn("We are under attack!")
+log.Error("Houston, we have a problem.")
+log.Fatal("So Long, and Thanks for All the Fislog.")
+log.Panic("The system is down.")
+```
+Format and print logs of different levels, all methods end with f
+
+```go
+log.Debugf("Hello %s", "boy")
+log.Infof("%d is the answer to life, the universe, and everything", 233)
+log.Warnf("We are under attack %s!", "boss")
+log.Errorf("%s, we have a problem.", "Master Shifu")
+log.Fatalf("So Long, and Thanks for All the %s.", "banana")
+```
+
+Print a message with the key and value, or `KEYVALS UNPAIRED` if the key and value are not a pair.
+
+```go
+log.Debugw("", "Hello", "boy")
+log.Infow("", "number", 233)
+log.Warnw("", "job", "boss")
+log.Errorw("", "name", "Master Shifu")
+log.Fatalw("", "fruit", "banana")
+```
+
+## Global log
+If you are in a project and just want to use a simple log function that can be printed at any time in the global, we provide a global log.
+
+```go
+import "github.com/gofiber/fiber/v2/log"
+
+log.Info("info")
+log.Warn("warn")
+```
+
+The above is using the default `log.DefaultLogger` standard output.
+You can also find an already implemented adaptation under contrib, or use your own implemented Logger and use `log.SetLogger` to set the global log logger.
+
+```go
+import (
+ "log"
+ fiberlog "github.com/gofiber/fiber/v2/log"
+)
+
+var _ log.AllLogger = (*customLogger)(nil)
+
+type customLogger struct {
+ stdlog *log.Logger
+}
+
+// ...
+// inject your custom logger
+fiberlog.SetLogger(customLogger)
+```
+
+## Set Level
+`log.SetLevel` sets the level of logs below which logs will not be output.
+The default logger is LevelTrace.
+
+Note that this method is not **concurrent-safe**.
+
+```go
+import "github.com/gofiber/fiber/v2/log"
+
+log.SetLevel(log.LevelInfo)
+```
+## Set output
+
+`log.SetOutput` sets the output destination of the logger. The default logger types the log in the console.
+
+```go
+var logger AllLogger = &defaultLogger{
+ stdlog: log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile|log.Lmicroseconds),
+ depth: 4,
+}
+```
+
+Set the output destination to the file.
+
+```go
+// Output to ./test.log file
+f, err := os.OpenFile("test.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
+if err != nil {
+ return
+}
+log.SetOutput(f)
+```
+Set the output destination to the console and file.
+
+```go
+// Output to ./test.log file
+file, _ := os.OpenFile("test.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
+iw := io.MultiWriter(os.Stdout, file)
+log.SetOutput(iw)
+```
+## Bind context
+Set the context, using the following method will return a `CommonLogger` instance bound to the specified context
+```go
+commonLogger := log.WithContext(ctx)
+commonLogger.Info("info")
+```
+
diff --git a/docs/api/middleware/_category_.json b/docs/api/middleware/_category_.json
new file mode 100644
index 0000000000..133ac5147a
--- /dev/null
+++ b/docs/api/middleware/_category_.json
@@ -0,0 +1,9 @@
+{
+ "label": "🧬 Middleware",
+ "position": 7,
+ "collapsed": true,
+ "link": {
+ "type": "generated-index",
+ "description": "Middleware is a function chained in the HTTP request cycle with access to the Context which it uses to perform a specific action, for example, logging every request or enabling CORS."
+ }
+}
\ No newline at end of file
diff --git a/docs/api/middleware/adaptor.md b/docs/api/middleware/adaptor.md
new file mode 100644
index 0000000000..64df229ce2
--- /dev/null
+++ b/docs/api/middleware/adaptor.md
@@ -0,0 +1,169 @@
+---
+id: adaptor
+---
+
+# Adaptor
+
+Converter for net/http handlers to/from Fiber request handlers, special thanks to [@arsmn](https://github.com/arsmn)!
+
+## Signatures
+| Name | Signature | Description
+| :--- | :--- | :---
+| HTTPHandler | `HTTPHandler(h http.Handler) fiber.Handler` | http.Handler -> fiber.Handler
+| HTTPHandlerFunc | `HTTPHandlerFunc(h http.HandlerFunc) fiber.Handler` | http.HandlerFunc -> fiber.Handler
+| HTTPMiddleware | `HTTPHandlerFunc(mw func(http.Handler) http.Handler) fiber.Handler` | func(http.Handler) http.Handler -> fiber.Handler
+| FiberHandler | `FiberHandler(h fiber.Handler) http.Handler` | fiber.Handler -> http.Handler
+| FiberHandlerFunc | `FiberHandlerFunc(h fiber.Handler) http.HandlerFunc` | fiber.Handler -> http.HandlerFunc
+| FiberApp | `FiberApp(app *fiber.App) http.HandlerFunc` | Fiber app -> http.HandlerFunc
+| ConvertRequest | `ConvertRequest(c *fiber.Ctx, forServer bool) (*http.Request, error)` | fiber.Ctx -> http.Request
+| CopyContextToFiberContext | `CopyContextToFiberContext(context interface{}, requestContext *fasthttp.RequestCtx)` | context.Context -> fasthttp.RequestCtx
+
+## Examples
+
+### net/http to Fiber
+```go
+package main
+
+import (
+ "fmt"
+ "net/http"
+
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/adaptor"
+)
+
+func main() {
+ // New fiber app
+ app := fiber.New()
+
+ // http.Handler -> fiber.Handler
+ app.Get("/", adaptor.HTTPHandler(handler(greet)))
+
+ // http.HandlerFunc -> fiber.Handler
+ app.Get("/func", adaptor.HTTPHandlerFunc(greet))
+
+ // Listen on port 3000
+ app.Listen(":3000")
+}
+
+func handler(f http.HandlerFunc) http.Handler {
+ return http.HandlerFunc(f)
+}
+
+func greet(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprint(w, "Hello World!")
+}
+```
+
+### net/http middleware to Fiber
+```go
+package main
+
+import (
+ "log"
+ "net/http"
+
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/adaptor"
+)
+
+func main() {
+ // New fiber app
+ app := fiber.New()
+
+ // http middleware -> fiber.Handler
+ app.Use(adaptor.HTTPMiddleware(logMiddleware))
+
+ // Listen on port 3000
+ app.Listen(":3000")
+}
+
+func logMiddleware(next http.Handler) http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ log.Println("log middleware")
+ next.ServeHTTP(w, r)
+ })
+}
+```
+
+### Fiber Handler to net/http
+```go
+package main
+
+import (
+ "net/http"
+
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/adaptor"
+)
+
+func main() {
+ // fiber.Handler -> http.Handler
+ http.Handle("/", adaptor.FiberHandler(greet))
+
+ // fiber.Handler -> http.HandlerFunc
+ http.HandleFunc("/func", adaptor.FiberHandlerFunc(greet))
+
+ // Listen on port 3000
+ http.ListenAndServe(":3000", nil)
+}
+
+func greet(c *fiber.Ctx) error {
+ return c.SendString("Hello World!")
+}
+```
+
+### Fiber App to net/http
+```go
+package main
+
+import (
+ "net/http"
+
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/adaptor"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/greet", greet)
+
+ // Listen on port 3000
+ http.ListenAndServe(":3000", adaptor.FiberApp(app))
+}
+
+func greet(c *fiber.Ctx) error {
+ return c.SendString("Hello World!")
+}
+```
+
+### Fiber Context to (net/http).Request
+```go
+package main
+
+import (
+ "net/http"
+
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/adaptor"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/greet", greetWithHTTPReq)
+
+ // Listen on port 3000
+ http.ListenAndServe(":3000", adaptor.FiberApp(app))
+}
+
+func greetWithHTTPReq(c *fiber.Ctx) error {
+ httpReq, err := adaptor.ConvertRequest(c, false)
+ if err != nil {
+ return err
+ }
+
+ return c.SendString("Request URL: " + httpReq.URL.String())
+}
+```
diff --git a/docs/api/middleware/basicauth.md b/docs/api/middleware/basicauth.md
new file mode 100644
index 0000000000..0e90eafed0
--- /dev/null
+++ b/docs/api/middleware/basicauth.md
@@ -0,0 +1,85 @@
+---
+id: basicauth
+---
+
+# BasicAuth
+
+Basic Authentication middleware for [Fiber](https://github.com/gofiber/fiber) that provides an HTTP basic authentication. It calls the next handler for valid credentials and [401 Unauthorized](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401) or a custom response for missing or invalid credentials.
+
+## Signatures
+
+```go
+func New(config Config) fiber.Handler
+```
+
+## Examples
+
+Import the middleware package that is part of the Fiber web framework
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/basicauth"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Provide a minimal config
+app.Use(basicauth.New(basicauth.Config{
+ Users: map[string]string{
+ "john": "doe",
+ "admin": "123456",
+ },
+}))
+
+// Or extend your config for customization
+app.Use(basicauth.New(basicauth.Config{
+ Users: map[string]string{
+ "john": "doe",
+ "admin": "123456",
+ },
+ Realm: "Forbidden",
+ Authorizer: func(user, pass string) bool {
+ if user == "john" && pass == "doe" {
+ return true
+ }
+ if user == "admin" && pass == "123456" {
+ return true
+ }
+ return false
+ },
+ Unauthorized: func(c *fiber.Ctx) error {
+ return c.SendFile("./unauthorized.html")
+ },
+ ContextUsername: "_user",
+ ContextPassword: "_pass",
+}))
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:----------------|:----------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| Users | `map[string]string` | Users defines the allowed credentials. | `map[string]string{}` |
+| Realm | `string` | Realm is a string to define the realm attribute of BasicAuth. The realm identifies the system to authenticate against and can be used by clients to save credentials. | `"Restricted"` |
+| Authorizer | `func(string, string) bool` | Authorizer defines a function to check the credentials. It will be called with a username and password and is expected to return true or false to indicate approval. | `nil` |
+| Unauthorized | `fiber.Handler` | Unauthorized defines the response body for unauthorized responses. | `nil` |
+| ContextUsername | `string` | ContextUsername is the key to store the username in Locals. | `"username"` |
+| ContextPassword | `string` | ContextPassword is the key to store the password in Locals. | `"password"` |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ Users: map[string]string{},
+ Realm: "Restricted",
+ Authorizer: nil,
+ Unauthorized: nil,
+ ContextUsername: "username",
+ ContextPassword: "password",
+}
+```
diff --git a/docs/api/middleware/cache.md b/docs/api/middleware/cache.md
new file mode 100644
index 0000000000..3a87306d3b
--- /dev/null
+++ b/docs/api/middleware/cache.md
@@ -0,0 +1,99 @@
+---
+id: cache
+---
+
+# Cache
+
+Cache middleware for [Fiber](https://github.com/gofiber/fiber) designed to intercept responses and cache them. This middleware will cache the `Body`, `Content-Type` and `StatusCode` using the `c.Path()` as unique identifier. Special thanks to [@codemicro](https://github.com/codemicro/fiber-cache) for creating this middleware for Fiber core!
+
+Request Directives
+`Cache-Control: no-cache` will return the up-to-date response but still caches it. You will always get a `miss` cache status.
+`Cache-Control: no-store` will refrain from caching. You will always get the up-to-date response.
+
+## Signatures
+
+```go
+func New(config ...Config) fiber.Handler
+```
+
+## Examples
+
+Import the middleware package that is part of the Fiber web framework
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/cache"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(cache.New())
+
+// Or extend your config for customization
+app.Use(cache.New(cache.Config{
+ Next: func(c *fiber.Ctx) bool {
+ return c.Query("refresh") == "true"
+ },
+ Expiration: 30 * time.Minute,
+ CacheControl: true,
+}))
+```
+
+Or you can custom key and expire time like this:
+
+```go
+app.Use(cache.New(cache.Config{
+ ExpirationGenerator: func(c *fiber.Ctx, cfg *cache.Config) time.Duration {
+ newCacheTime, _ := strconv.Atoi(c.GetRespHeader("Cache-Time", "600"))
+ return time.Second * time.Duration(newCacheTime)
+ },
+ KeyGenerator: func(c *fiber.Ctx) string {
+ return utils.CopyString(c.Path())
+ },
+}))
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Response().Header.Add("Cache-Time", "6000")
+ return c.SendString("hi")
+})
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:---------------------|:------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| Expiration | `time.Duration` | Expiration is the time that a cached response will live. | `1 * time.Minute` |
+| CacheHeader | `string` | CacheHeader is the header on the response header that indicates the cache status, with the possible return values "hit," "miss," or "unreachable." | `X-Cache` |
+| CacheControl | `bool` | CacheControl enables client-side caching if set to true. | `false` |
+| KeyGenerator | `func(*fiber.Ctx) string` | Key allows you to generate custom keys. | `func(c *fiber.Ctx) string { return utils.CopyString(c.Path()) }` |
+| ExpirationGenerator | `func(*fiber.Ctx, *cache.Config) time.Duration` | ExpirationGenerator allows you to generate custom expiration keys based on the request. | `nil` |
+| Storage | `fiber.Storage` | Store is used to store the state of the middleware. | In-memory store |
+| Store (Deprecated) | `fiber.Storage` | Deprecated: Use Storage instead. | In-memory store |
+| Key (Deprecated) | `func(*fiber.Ctx) string` | Deprecated: Use KeyGenerator instead. | `nil` |
+| StoreResponseHeaders | `bool` | StoreResponseHeaders allows you to store additional headers generated by next middlewares & handler. | `false` |
+| MaxBytes | `uint` | MaxBytes is the maximum number of bytes of response bodies simultaneously stored in cache. | `0` (No limit) |
+| Methods | `[]string` | Methods specifies the HTTP methods to cache. | `[]string{fiber.MethodGet, fiber.MethodHead}` |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ Expiration: 1 * time.Minute,
+ CacheHeader: "X-Cache",
+ CacheControl: false,
+ KeyGenerator: func(c *fiber.Ctx) string {
+ return utils.CopyString(c.Path())
+ },
+ ExpirationGenerator: nil,
+ StoreResponseHeaders: false,
+ Storage: nil,
+ MaxBytes: 0,
+ Methods: []string{fiber.MethodGet, fiber.MethodHead},
+}
+```
diff --git a/docs/api/middleware/compress.md b/docs/api/middleware/compress.md
new file mode 100644
index 0000000000..f284f5e92c
--- /dev/null
+++ b/docs/api/middleware/compress.md
@@ -0,0 +1,81 @@
+---
+id: compress
+---
+
+# Compress
+
+Compression middleware for [Fiber](https://github.com/gofiber/fiber) that will compress the response using `gzip`, `deflate` and `brotli` compression depending on the [Accept-Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) header.
+
+## Signatures
+
+```go
+func New(config ...Config) fiber.Handler
+```
+
+## Examples
+
+Import the middleware package that is part of the Fiber web framework
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/compress"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(compress.New())
+
+// Or extend your config for customization
+app.Use(compress.New(compress.Config{
+ Level: compress.LevelBestSpeed, // 1
+}))
+
+// Skip middleware for specific routes
+app.Use(compress.New(compress.Config{
+ Next: func(c *fiber.Ctx) bool {
+ return c.Path() == "/dont_compress"
+ },
+ Level: compress.LevelBestSpeed, // 1
+}))
+```
+
+## Config
+
+### Config
+
+| Property | Type | Description | Default |
+|:---------|:------------------------|:--------------------------------------------------------------------|:-------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| Level | `Level` | Level determines the compression algorithm. | `LevelDefault (0)` |
+
+Possible values for the "Level" field are:
+
+- `LevelDisabled (-1)`: Compression is disabled.
+- `LevelDefault (0)`: Default compression level.
+- `LevelBestSpeed (1)`: Best compression speed.
+- `LevelBestCompression (2)`: Best compression.
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ Level: LevelDefault,
+}
+```
+
+## Constants
+
+```go
+// Compression levels
+const (
+ LevelDisabled = -1
+ LevelDefault = 0
+ LevelBestSpeed = 1
+ LevelBestCompression = 2
+)
+```
diff --git a/docs/api/middleware/cors.md b/docs/api/middleware/cors.md
new file mode 100644
index 0000000000..af9b8c5f2b
--- /dev/null
+++ b/docs/api/middleware/cors.md
@@ -0,0 +1,88 @@
+---
+id: cors
+---
+
+# CORS
+
+CORS middleware for [Fiber](https://github.com/gofiber/fiber) that can be used to enable [Cross-Origin Resource Sharing](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) with various options.
+
+## Signatures
+
+```go
+func New(config ...Config) fiber.Handler
+```
+
+## Examples
+
+Import the middleware package that is part of the Fiber web framework
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/cors"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(cors.New())
+
+// Or extend your config for customization
+app.Use(cors.New(cors.Config{
+ AllowOrigins: "https://gofiber.io, https://gofiber.net",
+ AllowHeaders: "Origin, Content-Type, Accept",
+}))
+```
+
+Using the `AllowOriginsFunc` function. In this example any origin will be allowed via CORS.
+
+For example, if a browser running on `http://localhost:3000` sends a request, this will be accepted and the `access-control-allow-origin` response header will be set to `http://localhost:3000`.
+
+**Note: Using this feature is discouraged in production and it's best practice to explicitly set CORS origins via `AllowOrigins`.**
+
+```go
+app.Use(cors.New())
+
+app.Use(cors.New(cors.Config{
+ AllowOriginsFunc: func(origin string) bool {
+ return os.Getenv("ENVIRONMENT") == "development"
+ },
+}))
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:-----------------|:---------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| AllowOriginsFunc | `func(origin string) bool` | AllowOriginsFunc defines a function that will set the 'access-control-allow-origin' response header to the 'origin' request header when returned true. | `nil` |
+| AllowOrigins | `string` | AllowOrigin defines a list of origins that may access the resource. | `"*"` |
+| AllowMethods | `string` | AllowMethods defines a list methods allowed when accessing the resource. This is used in response to a preflight request. | `"GET,POST,HEAD,PUT,DELETE,PATCH"` |
+| AllowHeaders | `string` | AllowHeaders defines a list of request headers that can be used when making the actual request. This is in response to a preflight request. | `""` |
+| AllowCredentials | `bool` | AllowCredentials indicates whether or not the response to the request can be exposed when the credentials flag is true. | `false` |
+| ExposeHeaders | `string` | ExposeHeaders defines a whitelist headers that clients are allowed to access. | `""` |
+| MaxAge | `int` | MaxAge indicates how long (in seconds) the results of a preflight request can be cached. | `0` |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ AllowOriginsFunc: nil,
+ AllowOrigins: "*",
+ AllowMethods: strings.Join([]string{
+ fiber.MethodGet,
+ fiber.MethodPost,
+ fiber.MethodHead,
+ fiber.MethodPut,
+ fiber.MethodDelete,
+ fiber.MethodPatch,
+ }, ","),
+ AllowHeaders: "",
+ AllowCredentials: false,
+ ExposeHeaders: "",
+ MaxAge: 0,
+}
+```
diff --git a/docs/api/middleware/csrf.md b/docs/api/middleware/csrf.md
new file mode 100644
index 0000000000..dbbf6007d9
--- /dev/null
+++ b/docs/api/middleware/csrf.md
@@ -0,0 +1,111 @@
+---
+id: csrf
+---
+
+# CSRF
+
+CSRF middleware for [Fiber](https://github.com/gofiber/fiber) that provides [Cross-site request forgery](https://en.wikipedia.org/wiki/Cross-site_request_forgery) protection by passing a csrf token via cookies. This cookie value will be used to compare against the client csrf token on requests, other than those defined as "safe" by RFC7231 \(GET, HEAD, OPTIONS, or TRACE\). When the csrf token is invalid, this middleware will return the `fiber.ErrForbidden` error.
+
+CSRF Tokens are generated on GET requests. You can retrieve the CSRF token with `c.Locals(contextKey)`, where `contextKey` is the string you set in the config (see Custom Config below).
+
+When no `csrf_` cookie is set, or the token has expired, a new token will be generated and `csrf_` cookie set.
+
+:::note
+This middleware uses our [Storage](https://github.com/gofiber/storage) package to support various databases through a single interface. The default configuration for this middleware saves data to memory, see the examples below for other databases.
+:::
+
+## Signatures
+
+```go
+func New(config ...Config) fiber.Handler
+```
+
+## Examples
+
+Import the middleware package that is part of the Fiber web framework
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/csrf"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(csrf.New())
+
+// Or extend your config for customization
+app.Use(csrf.New(csrf.Config{
+ KeyLookup: "header:X-Csrf-Token",
+ CookieName: "csrf_",
+ CookieSameSite: "Lax",
+ Expiration: 1 * time.Hour,
+ KeyGenerator: utils.UUID,
+ Extractor: func(c *fiber.Ctx) (string, error) { ... },
+}))
+```
+
+:::note
+KeyLookup will be ignored if Extractor is explicitly set.
+:::
+
+## Config
+
+### Config
+
+| Property | Type | Description | Default |
+|:------------------|:-----------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| KeyLookup | `string` | KeyLookup is a string in the form of "`