diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..6a4ec76
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,8 @@
+; This file is for unifying the coding style for different editors and IDEs.
+; More information at http://editorconfig.org
+; This style originates from https://github.com/fewagency/best-practices
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..963a68e
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,12 @@
+# Handle line endings automatically for files detected as text
+# and leave all files detected as binary untouched.
+* text=auto eol=lf
+
+# Force batch scripts to always use CRLF line endings so that if a repo is accessed
+# in Windows via a file share from Linux, the scripts will work.
+*.{cmd,[cC][mM][dD]} text eol=crlf
+*.{bat,[bB][aA][tT]} text eol=crlf
+
+# Force bash scripts to always use LF line endings so that if a repo is accessed
+# in Unix via a file share from Windows, the scripts will work.
+*.sh text eol=lf
diff --git a/.github/.editorconfig b/.github/.editorconfig
new file mode 100644
index 0000000..85a920c
--- /dev/null
+++ b/.github/.editorconfig
@@ -0,0 +1,23 @@
+; https://editorconfig.org/
+
+root = true
+
+[*]
+insert_final_newline = true
+charset = utf-8
+trim_trailing_whitespace = true
+indent_style = space
+indent_size = 2
+
+[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
+indent_style = tab
+indent_size = 8
+
+[*.md]
+indent_size = 4
+trim_trailing_whitespace = false
+
+eclint_indent_style = unset
+
+[Dockerfile]
+indent_size = 4
\ No newline at end of file
diff --git a/.github/.hound.yml b/.github/.hound.yml
new file mode 100644
index 0000000..59d7bb8
--- /dev/null
+++ b/.github/.hound.yml
@@ -0,0 +1,2 @@
+golint:
+ enabled: false
\ No newline at end of file
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000..957d1b1
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1 @@
+* @gofiber/maintainers
diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..c8d7ee4
--- /dev/null
+++ b/.github/CODE_OF_CONDUCT.md
@@ -0,0 +1,81 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our community include:
+
+- Demonstrating empathy and kindness toward other people
+- Being respectful of differing opinions, viewpoints, and experiences
+- Giving and gracefully accepting constructive feedback
+- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
+- Focusing on what is best not just for us as individuals, but for the overall community
+
+Examples of unacceptable behavior include:
+
+- The use of sexualized language or imagery, and sexual attention or advances of any kind
+- Trolling, insulting or derogatory comments, and personal or political attacks
+- Public or private harassment
+- Publishing others' private information, such as a physical or email address, without their explicit permission
+- Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [Discord](https://gofiber.io/discord). All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series of actions.
+
+**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within the community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
+available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
+
+Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see the FAQ at
+https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
new file mode 100644
index 0000000..e35ce19
--- /dev/null
+++ b/.github/CONTRIBUTING.md
@@ -0,0 +1,27 @@
+# Contributing
+
+Before making any changes to this repository, we kindly request you to initiate discussions for proposed changes that do not yet have an associated [issue](https://github.com/gofiber/fiber/issues). Please use our [Discord](https://gofiber.io/discord) server to initiate these discussions. For [issue](https://github.com/gofiber/fiber/issues) that already exist, you may proceed with discussions using our [issue](https://github.com/gofiber/fiber/issues) tracker or any other suitable method, in consultation with the repository owners. Your collaboration is greatly appreciated.
+
+Please note: we have a [code of conduct](https://github.com/gofiber/fiber/blob/master/.github/CODE_OF_CONDUCT.md), please follow it in all your interactions with the `Fiber` project.
+
+## Pull Requests or Commits
+Titles always we must use prefix according to below:
+
+> 🔥 Feature, ♻️ Refactor, 🩹 Fix, 🚨 Test, 📚 Doc, 🎨 Style
+- 🔥 Feature: Add flow to add person
+- ♻️ Refactor: Rename file X to Y
+- 🩹 Fix: Improve flow
+- 🚨 Test: Validate to add a new person
+- 📚 Doc: Translate to Portuguese middleware redirect
+- 🎨 Style: Respected pattern Golint
+
+All pull requests that contain a feature or fix are mandatory to have unit tests. Your PR is only to be merged if you respect this flow.
+
+# 👍 Contribute
+
+If you want to say **thank you** and/or support the active development of `Fiber`:
+
+1. Add a [GitHub Star](https://github.com/gofiber/fiber/stargazers) to the project.
+2. Tweet about the project [on your 𝕏 (Twitter)](https://x.com/intent/tweet?text=%F0%9F%9A%80%20Fiber%20%E2%80%94%20is%20an%20Express.js%20inspired%20web%20framework%20build%20on%20Fasthttp%20for%20%23Go%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Write a review or tutorial on [Medium](https://medium.com/), [Dev.to](https://dev.to/) or personal blog.
+4. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..d041abf
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,8 @@
+# These are supported funding model platforms
+
+github: [gofiber] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+custom: https://gofiber.io/support
diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml
new file mode 100644
index 0000000..c48df1d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug-report.yaml
@@ -0,0 +1,85 @@
+name: "\U0001F41B Bug Report"
+title: "\U0001F41B [Bug]: "
+description: Create a bug report to help us fix it.
+labels: ["☢️ Bug"]
+
+body:
+ - type: markdown
+ id: notice
+ attributes:
+ 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.**
+ - 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 clearly and in detail."
+ validations:
+ required: true
+ - type: textarea
+ id: how-to-reproduce
+ attributes:
+ label: How to Reproduce
+ description: "Steps to reproduce the behavior and what should be observed in the end."
+ placeholder: "Tell us step by step how we can replicate your problem and what we should see in the end."
+ value: |
+ Steps to reproduce the behavior:
+ 1. Go to '....'
+ 2. Click on '....'
+ 3. Do '....'
+ 4. See '....'
+ validations:
+ required: true
+ - type: textarea
+ id: expected-behavior
+ attributes:
+ label: Expected Behavior
+ description: "A clear and detailed description of what you think should happen."
+ placeholder: "Tell us what Fiber should normally do."
+ validations:
+ required: true
+ - type: input
+ id: version
+ attributes:
+ label: "Fiber Version"
+ description: "Some bugs may be fixed in future Fiber releases, so we have to know your Fiber version."
+ placeholder: "Write your Fiber version. (v2.33.0, v2.34.1...)"
+ validations:
+ required: true
+ - type: textarea
+ id: snippet
+ attributes:
+ label: "Code Snippet (optional)"
+ description: "For some issues, we need to know some parts of your code."
+ placeholder: "Share a code snippet that you think is related to the issue."
+ render: go
+ value: |
+ package main
+
+ import "github.com/gofiber/fiber/v2"
+ import "log"
+
+ func main() {
+ app := fiber.New()
+
+ // Steps to reproduce
+
+ log.Fatal(app.Listen(":3000"))
+ }
+ - type: checkboxes
+ id: terms
+ attributes:
+ label: "Checklist:"
+ description: "By submitting this issue, you confirm that:"
+ options:
+ - label: "I agree to follow Fiber's [Code of Conduct](https://github.com/gofiber/fiber/blob/master/.github/CODE_OF_CONDUCT.md)."
+ required: true
+ - label: "I have checked for existing issues that describe my problem prior to opening this one."
+ required: true
+ - label: "I understand that improperly formatted bug reports may be closed without explanation."
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/feature-request.yaml b/.github/ISSUE_TEMPLATE/feature-request.yaml
new file mode 100644
index 0000000..fbdb871
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature-request.yaml
@@ -0,0 +1,60 @@
+name: "\U0001F680 Feature Request"
+title: "\U0001F680 [Feature]: "
+description: Suggest an idea to improve this project.
+labels: ["✏️ Feature"]
+
+body:
+ - type: markdown
+ id: notice
+ attributes:
+ value: |
+ ### Notice
+ - 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 you would like to see added."
+ placeholder: "Explain your feature clearly, and in detail."
+ validations:
+ required: true
+ - type: textarea
+ id: additional-context
+ attributes:
+ label: "Additional Context (optional)"
+ description: "If you have something else to describe, write them here."
+ placeholder: "Write here what you can describe differently."
+ - type: textarea
+ id: snippet
+ attributes:
+ label: "Code Snippet (optional)"
+ description: "Code snippet may be really helpful to describe some features."
+ placeholder: "Share a code snippet to explain the feature better."
+ render: go
+ value: |
+ package main
+
+ import "github.com/gofiber/fiber/v2"
+ import "log"
+
+ func main() {
+ app := fiber.New()
+
+ // An example to describe the feature
+
+ log.Fatal(app.Listen(":3000"))
+ }
+ - type: checkboxes
+ id: terms
+ attributes:
+ label: "Checklist:"
+ description: "By submitting this issue, you confirm that:"
+ options:
+ - label: "I agree to follow Fiber's [Code of Conduct](https://github.com/gofiber/fiber/blob/master/.github/CODE_OF_CONDUCT.md)."
+ required: true
+ - label: "I have checked for existing issues that describe my suggestion prior to opening this one."
+ required: true
+ - label: "I understand that improperly formatted feature requests may be closed without explanation."
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/question.yaml b/.github/ISSUE_TEMPLATE/question.yaml
new file mode 100644
index 0000000..7204183
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/question.yaml
@@ -0,0 +1,55 @@
+name: "🤔 Question"
+title: "\U0001F917 [Question]: "
+description: Ask a question so we can help you easily.
+labels: ["🤔 Question"]
+
+body:
+ - type: markdown
+ id: notice
+ attributes:
+ value: |
+ ### Notice
+ - 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 clearly, and in detail."
+ validations:
+ required: true
+ - type: textarea
+ id: snippet
+ attributes:
+ label: "Code Snippet (optional)"
+ description: "Code snippet may be really helpful to describe some features."
+ placeholder: "Share a code snippet to explain the feature better."
+ render: go
+ value: |
+ package main
+
+ import "github.com/gofiber/fiber/v2"
+ import "log"
+
+ func main() {
+ app := fiber.New()
+
+ // An example to describe the question
+
+ log.Fatal(app.Listen(":3000"))
+ }
+ - type: checkboxes
+ id: terms
+ attributes:
+ label: "Checklist:"
+ description: "By submitting this issue, you confirm that:"
+ options:
+ - label: "I agree to follow Fiber's [Code of Conduct](https://github.com/gofiber/fiber/blob/master/.github/CODE_OF_CONDUCT.md)."
+ required: true
+ - label: "I have checked for existing issues that describe my questions prior to opening this one."
+ required: true
+ - label: "I understand that improperly formatted questions may be closed without explanation."
+ required: true
diff --git a/.github/README.md b/.github/README.md
new file mode 100644
index 0000000..172ecc5
--- /dev/null
+++ b/.github/README.md
@@ -0,0 +1,716 @@
+
+ Fiber is an Express inspired web framework built on top of Fasthttp, the fastest HTTP engine for Go. Designed to ease things up for fast development with zero memory allocation and performance in mind.
+
+
+## ⚡️ Quickstart
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Benchmarks
+
+These tests are performed by [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) and [Go Web](https://github.com/smallnest/go-web-framework-benchmark). If you want to see all the results, please visit our [Wiki](https://docs.gofiber.io/extra/benchmarks).
+
+
+
+
+
+
+## ⚙️ Installation
+
+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:
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Features
+
+- 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/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)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- Translated in [19 languages](https://docs.gofiber.io/)
+- And much more, [explore Fiber](https://docs.gofiber.io/)
+
+## 💡 Philosophy
+
+New gophers that make the switch from [Node.js](https://nodejs.org/en/about/) to [Go](https://go.dev/doc/) are dealing with a learning curve before they can start building their web applications or microservices. Fiber, as a **web framework**, was created with the idea of **minimalism** and follows the **UNIX way**, so that new gophers can quickly enter the world of Go with a warm and trusted welcome.
+
+Fiber is **inspired** by Express, the most popular web framework on the Internet. We combined the **ease** of Express and **raw performance** of Go. If you have ever implemented a web application in Node.js (_using Express or similar_), then many methods and principles will seem **very common** to you.
+
+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.17 to 1.21.
+- 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
+
+Listed below are some of the common examples. If you want to see more code examples, please visit our [Recipes repository](https://github.com/gofiber/recipes) or visit our hosted [API documentation](https://docs.gofiber.io).
+
+#### 📖 [**Basic Routing**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Serving Static Files**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware & Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/list
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 Show more code examples
+
+### Views engines
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Engines](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Fiber defaults to the [html/template](https://pkg.go.dev/html/template/) when no view engine is set.
+
+If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
+
+Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Grouping routes into chains
+
+📖 [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"))
+}
+```
+
+Check CORS by passing any domain in `Origin` header:
+
+```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!")
+ })
+
+ // Last middleware to match anything
+ 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 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"))
+}
+```
+
+### Recover middleware
+
+📖 [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"))
+}
+```
+
+
+
+### Using Trusted Proxy
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/recover"
+)
+
+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,
+ })
+
+ // ...
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+## 🧬 Internal Middleware
+
+Here is a list of middleware that are included within the Fiber framework.
+
+| Middleware | Description |
+| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercept and cache responses |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Expose environment variables with providing an optional config. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Allows you to proxy requests to a multiple servers |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [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
+
+List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
+
+| Middleware | Description |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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).
+
+## 👍 Contribute
+
+If you want to say **thank you** and/or support the active development of `Fiber`:
+
+1. Add a [GitHub Star](https://github.com/gofiber/fiber/stargazers) to the project.
+2. Tweet about the project [on your 𝕏 (Twitter)](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Write a review or tutorial on [Medium](https://medium.com/), [Dev.to](https://dev.to/) or personal blog.
+4. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
+
+## ☕ Supporters
+
+Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny).
+
+| | User | Donation |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------- |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/marvinjwendt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Code Contributors
+
+
+
+## ⭐️ Stargazers
+
+
+
+## ⚠️ 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).
+
+**Third-party library licenses**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_az.md b/.github/README_az.md
new file mode 100644
index 0000000..f1b6174
--- /dev/null
+++ b/.github/README_az.md
@@ -0,0 +1,716 @@
+
+ FiberGo 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.
+
+
+## ⚡️ Sürətli Başlanğıc
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Performans Dəyərləri
+
+Bu testlər [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) və [Go Web](https://github.com/smallnest/go-web-framework-benchmark) tərəfindən aparılıb. Bütün nəticələri görmək üçün [Wiki](https://docs.gofiber.io/extra/benchmarks) səhifəsinə keçid edə bilərsiniz.
+
+
+
+
+
+
+## ⚙️ Quraşdırılması
+
+Go dilinin `1.17` və ya daha yuxarı versiyanın [yükləndiyindən](https://go.dev/dl/) əmin olun.
+
+Bir qovluq yaratdıqdan sonra, `go mod init github.com/your/repo` komandasını eyni qovluğun daxilində işə salaraq layihənizi başladın ([go modulları haqqında əlavə bilgilər](https://go.dev/blog/using-go-modules)). Növbəti addım olaraq Fiber-i [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) komandasını işlədərək yükləyin:
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Özəllikləri
+
+- Güclü [routing](https://docs.gofiber.io/guide/routing)
+- [Static faylların](https://docs.gofiber.io/api/app#static) təqdimatı
+- Yüksək [performans](https://docs.gofiber.io/extra/benchmarks)
+- [Daha az yaddaş istifadəsi](https://docs.gofiber.io/extra/benchmarks)
+- [API son nöqtələri (endpoint)](https://docs.gofiber.io/api/ctx)
+- [Middleware](https://docs.gofiber.io/category/-middleware) & [Next](https://docs.gofiber.io/api/ctx#next) dəstəyi
+- [Rapid](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) server yönümlü proqramlaşdırma
+- [Template mühərrikləri](https://github.com/gofiber/template)
+- [WebSocket dəstəyi](https://github.com/gofiber/websocket)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- [19 dildə](https://docs.gofiber.io/) mövcudluğu
+
+Daha ətraflı məlumat üçün [rəsmi sənədləşməyə](https://docs.gofiber.io/) baxış keçirə bilərsiniz.
+
+## 💡 Fəlsəfə
+
+[Node.js](https://nodejs.org/en/about/)-dən [Go](https://go.dev/doc/)-ya yeni keçən gopher-lər veb tətbiqlər və mikroservislər yazmadan öncə dilin özünəməxsus sintaksisini öyrənməklə məşğul olurlar. Fiber Minimalizm və UNIX-in yaradılış prinsiplərinə uyğun şəkildə qurulmuş bir web framework-dür. Bu sahədə yeni olan gopher-lər Go dünyasında özlərini doğma və güvənli hiss edə biləcək şəkildə bir ab-hava ilə rastlaşa bilərlər.
+
+Fiber internet üzərində olan ən məşhur web framework-lərdən biri olan Express-dən ilhamlanaraq ərsəyə gəlmişdir. Biz Express-in rahatlıq və asanlıq xüsusiyyətlərini, Go-nun çiy performansı ilə birləşdirmişik; əgər əvvəldən Node.js üzərində (Express və ya bənzərləri) veb tətbiqi yaratmısınızsa, onda əksər metodlar və prinsiplər sizə tanış gələcəkdir.
+
+Biz istifadəçilərdən gələn [issue-a](https://github.com/gofiber/fiber/issues), Discord [kanalımıza](https://gofiber.io/discord) və bütün interneti əhatə edən vasitələrdən gələn rəyləri nəzərə alırıq. Bunun nəzdində, biz sürətli və rahat şəkildə hər bir tapşırığın səviyyəsinə uyğun olan — dostcasına bir Go web framework-ü olmağı hədəfləmişik (Express-in JavaScript dünyasında etdiyi kimi).
+
+## ⚠️ Limitlər
+
+- Fiber unsafe prinsiplərə əsaslanaraq çalışdığından, o hər zaman Go-nun son versiyası ilə uyğunlaşmaya bilər. Buna görə də, Fiber 2.40.0 — Go 1.17 və 1.21 versiyaları ilə test edilərək saz vəziyyətə gətirilmişdir.
+- Fiber net/http interfeysləri ilə uyğun deyil. Yəni gqlgen, go-swagger kimi net/http ekosisteminin parçası olan layihələri istifadə edə bilməzsiniz.
+
+## 👀 Misallar
+
+Aşağıda geniş istifadə olunan misallardan bəziləri siyahı şəklində qeyd olunub. Əgər daha çox koda dair misalları görmək istəyirsinizsə, onda [Əlavə misallardan ibarət github deposunu](https://github.com/gofiber/recipes) və ya [API sənədləşməni](https://docs.gofiber.io) nəzərdən keçirin.
+
+#### 📖 [**Sadə Routing**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Route-un Adlandırılması**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Static Fayl Təqdimatı**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware & Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/list
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 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"))
+}
+```
+
+
+
+### Etibarlı Proxy İstifadəsi
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/recover"
+)
+
+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,
+ })
+
+ // ...
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+## 🧬 Daxili Middleware
+
+Aşağıda Fiber-in daxilində olan middleware-lər siyahı şəklində göstərilmişdir.
+
+| Middleware | Açıqlama |
+| :------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Sadə bir auth middleware-dir və HTTP Basic Auth yaratmaq üçün istifadə olunur. Keçərli vəsiqə (credentials) bilgiləri üçün sonrakı handler-i, əksik və ya keçərsiz vəsiqə bilgiləri üçün 401 qaytarır. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Response-ı dayandırır və keşə yerləşdirir. |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Fiber üçün sıxışdırma (compression) middleware-dir. Default olaraq `deflate`, `gzip` və `brotli` dəstəkləyir. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Çeşidli seçimlərlə başlanğıclar arası mənbə paylaşımı (CORS) aktivləşdirir. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | CSRF exploit-dən qorunmasını təmin edir. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware-i cookie dəyərlərini şifrələyir. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Environment dəyərlərini göstərilən config-ə görə təyin edir. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | Keşlərin daha səmərəli istifadəsinə və bant genişliyinə qənaət etməyə imkan verən ETag middleware-i; məzmun dəyişməyibsə veb serverin response-nı təkrar göndərməsinin qarşısını alır. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware, HTTP serverlərinin bəzi runtime dəyərlərini JSON formatında göstərir. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Əgər faylın yolu (path) göstərilmişdirsə, artıq loglarda olan favicon-u yox sayıb onu saxlanan depodan götürür. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | Fiber üçün fayl sistem middleware-i. Alireza Salary-ə xüsusi təşəkkürlər. |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Fiber üçün rate limitləyən middleware. Açıq API-ə və ya şifrə yeniləmə kimi endpoint-ə yönəlik təkrarlanan request-in qarşısını alır. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP istək/cavab (request/response) logger-i. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware-i serverin metriklərini report edər ("Express-status-monitor"-dan qaynaqlanıb). |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Matthew Lee-yə xüsusi təşəkkürlər \(@mthli\). |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Birdən çox server-ə proxy istəyi göndərməyiniz üçündür. |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware-i stack chain-ni hər hansı bir yerindəki paniklərdən qurtulmasına kömək edir və kontrolu mərkəzləşdirilmiş [ErrorHandler-ə](https://docs.gofiber.io/guide/error-handling) ötürür. |
+| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | Hər request üçün ayrı request id yaradır. |
+| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session üçün middleware. Qeyd: Bu middleware Fiber-in öz storage struktrunu istifadə edir. |
+| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware-i verilən şərt true olduğu halda handler-i görməyərək üstündən ötüb keçir. |
+| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Bir request üçün maksimum vaxt əlavə edir. Əgər arada fasilə yaranarsa, onda proses məhz ErrorHandler-ə göndərilərək icra edilir. |
+| [keyauth](https://github.com/gofiber/keyauth) | Key giriş middleware-i, key əsaslı bir authentication metodudur. |
+| [redirect](https://github.com/gofiber/redirect) | Yönləndirmə üçün middleware. |
+| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware-i verilən qanunlara əsasən URL yolunu (path) yenidən yazır. Geri dönüşün icrası üçün uyğunluq təşkil edən təsviri linklərin yaradılması üçün nəzərdə tutulmuşdur. |
+| [adaptor](https://github.com/gofiber/adaptor) | Fiber request handler-dən net/http handler-ə çevirici. @arsmn-ə xüsusi təşəkkürlər! |
+| [helmet](https://github.com/gofiber/helmet) | Fərqli HTTP header istifadə edərək tətbiqi daha təhlükəsiz saxlamağa kömək edir. |
+
+## 🧬 Xarici Middleware
+
+[Fiber komandası](https://github.com/orgs/gofiber/people) tərəfindən dəstəklənən və inkişaf etdirilən middleware-in siyahısı.
+
+| Middleware | Description |
+| :------------------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT, JSON Web Token(JWT) girişi qaytaran bir middleware-dir. |
+| [storage](https://github.com/gofiber/storage) | Fiber-in Storage arxitekturasını dəstəkləyən bir sıra storage driver verir. Bu sayədə storage-ə ehtiyac duyan Fiber middleware-də rahatlıqla istifadə oluna bilər. |
+| [template](https://github.com/gofiber/template) | Bu paket, Fiber `v1.10.x`, Go versiyası 1.13 və ya daha yuxarı olduqda istifadə oluna bilər. 8 template mühərriki var. |
+| [websocket](https://github.com/gofiber/websocket) | Yerlilərin dəstəyi ilə WebSocket-ə əsaslanan Fiber üçün Fasthttp. |
+
+## 🕶️ Möhtəşəm Siyahı
+
+Əlavə yazılar, middleware-lər, misallar, və alətlər üçün bizim [möhtəşəm siyahımıza](https://github.com/gofiber/awesome-fiber) göz atın.
+
+## 👍 Dəstək Nümayişi
+
+Əgər `Fiber`-ə dəstək olmaq və ya **təşəkkür etmək** istəyirsinizsə:
+
+1. Layihəni [GitHub Ulduzu](https://github.com/gofiber/fiber/stargazers) ilə işarələyin.
+2. Layihə haqqında [şəxsi 𝕏 (Twitter) hesabınızda](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber) paylaşın.
+3. [Medium](https://medium.com/), [Dev.to](https://dev.to/) və ya şəxsi bloqunuz üzərindən bir incələmə və ya tədris yönümlü bir yazı dərc edin.
+4. Bizim üçün, sadəcə bir [fincan kofe alın](https://buymeacoff.ee/fenny).
+
+## ☕ "Bir fincan kofe almaq" məsələsi
+
+Fiber açıq qaynaqlı bir layihə olduğu üçün, gəlirlərini yalnız ianələr vasitəsilə təmin edir və bu da domain adı, gitbook, netlify, serverless hosting xərcləri üçün istifadə olunur. Belə olduğu halda, Fiber-ə ən yaxşı dəstək elə bizim üçün ☕ [**bir kofe almaqdan gələ bilər**](https://buymeacoff.ee/fenny).
+
+| | İstifadəçi | İanə |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------ |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/marvinjwendt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Koda Töhfə Verənlər
+
+
+
+## ⭐️ Layihəni Ulduzlayanlar
+
+
+
+## ⚠️ Lisenziya Haqqında
+
+Müəllif Hüququ (c) 2019-bugün [Fenny](https://github.com/fenny) və [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` pulsuz və açıq qaynaqlı bir proqram təminatıdır və [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE) altında lisenziyalaşmışdır. Rəsmi loqo [Vic Shóstak](https://github.com/koddr) tərəfindən yaradılmış və [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) lisenziyası altında paylanmışdır (CC BY-SA 4.0 International).
+
+**Üçüncü Tərəf Kitabxana Lisenziyaları**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_ckb.md b/.github/README_ckb.md
new file mode 100644
index 0000000..5f52bf8
--- /dev/null
+++ b/.github/README_ckb.md
@@ -0,0 +1,714 @@
+
+Fiber ist ein von Expressjs inspiriertes Web-Framework, aufgebaut auf Fasthttp - die schnellste HTTP engine für Go. Kreiert, um Dinge zu vereinfachen, für schnelle Entwicklung mit keinen Speicherzuweisungen und Performance im Hinterkopf.
+
+
+## ⚡️ Schnellstart
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hallo, Welt 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Benchmarks
+
+Diese Tests wurden von [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) und [Go Web](https://github.com/smallnest/go-web-framework-benchmark) ausgeführt. Falls du alle Resultate sehen möchtest, besuche bitte unser [Wiki](https://docs.gofiber.io/extra/benchmarks).
+
+
+
+
+
+
+## ⚙️ Installation
+
+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:
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Eigenschaften
+
+- 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/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)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- Verfügbar in [19 Sprachen](https://docs.gofiber.io/)
+- Und vieles mehr - [erkunde Fiber](https://docs.gofiber.io/)
+
+## 💡 Philosophie
+
+Neue Gopher, welche von [Node.js](https://nodejs.org/en/about/) zu [Go](https://go.dev/doc/) umsteigen, müssen eine Lernkurve durchlaufen, bevor sie ihre Webanwendungen oder Microservices erstellen können. Fiber als **Web-Framework**, wurde mit der Idee von **Minimalismus** erschaffen und folgt dem **UNIX Weg**, damit neue Gophers mit einem herzlichen und vertrauenswürdigen Willkommen schnell in der Welt von Go durchstarten können.
+
+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.17 to 1.21.
+- 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
+
+Nachfolgend sind einige der gängigsten Beispiele aufgeführt. Wenn du weitere Codebeispiele sehen möchtest, besuche bitte unser ["Recipes Repository"](https://github.com/gofiber/recipes) oder besuche unsere [API Dokumentation](https://docs.gofiber.io).
+
+#### 📖 [**Basic Routing**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Serving Static Files**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware & Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/register
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 Show more code examples
+
+### Views engines
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Engines](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Fiber defaults to the [html/template](https://pkg.go.dev/html/template/) when no view engine is set.
+
+If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
+
+Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Grouping routes into chains
+
+📖 [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"))
+}
+```
+
+Check CORS by passing any domain in `Origin` header:
+
+```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!")
+ })
+
+ // Last middleware to match anything
+ 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 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"))
+}
+```
+
+### Recover middleware
+
+📖 [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"))
+}
+```
+
+
+
+## 🧬 Internal Middleware
+
+Hier finden Sie eine Liste der Middleware, die im Fiber-Framework enthalten ist.
+
+| Middleware | Description |
+| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercept and cache responses |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Expose environment variables with providing an optional config. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Allows you to proxy requests to a multiple servers |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [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 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
+
+Liste der extern gehosteten Middleware-Module, die vom [Fiber team](https://github.com/orgs/gofiber/people) gepflegt werden.
+
+| Middleware | Description |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- | --- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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! |
+
+## 🕶️ Awesome List
+
+Weitere Artikel, Middlewares, Beispiele oder Tools finden Sie in unserer [awesome list](https://github.com/gofiber/awesome-fiber).
+
+## 👍 Mitwirken
+
+Falls du **danke** sagen möchtest und/oder aktiv die Entwicklung von `fiber` fördern möchtest:
+
+1. Füge dem Projekt einen [GitHub Stern](https://github.com/gofiber/fiber/stargazers) hinzu.
+2. Twittere über das Projekt [auf deinem 𝕏 (Twitter)](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Schreibe eine Rezension auf [Medium](https://medium.com/), [Dev.to](https://dev.to/) oder einem persönlichem Blog.
+4. Unterstütze das Projekt, indem du ☕ [uns einen Kaffee kaufst](https://buymeacoff.ee/fenny).
+
+## ☕ Supporters
+
+Fiber ist ein Open-Source-Projekt, dass durch Spenden finanziert wird und welches auch seine Ausgaben (Domain, Hosting) durch Spenden deckt. Wenn du Fiber unterstützen möchtest, kannst du uns [**hier einen Kaffee kaufen**](https://buymeacoff.ee/fenny) ☕.
+
+| | User | Donation |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------- |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Code Contributors
+
+
+
+## ⭐️ Stargazers
+
+
+
+## ⚠️ 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).
+
+**Third-party MIT licenses**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_eg.md b/.github/README_eg.md
new file mode 100644
index 0000000..3eea117
--- /dev/null
+++ b/.github/README_eg.md
@@ -0,0 +1,717 @@
+
+ فايبر هي ويب فريمورك مستوحاه من اكسبريس ومبنيه على فاست اتش تي تي بي وهي اسرع محركات الويب للغه جو. مصممة عشان تسهل و تسرع التطوير ومابتعملش memory allocation زيادة. وبتهتم بالبيرفورمانس.
+
+
+## ⚡️ بداية سريعة
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 القياسات
+
+القياسات دي اتعملت عن طريق [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) و [Go Web](https://github.com/smallnest/go-web-framework-benchmark). لو عاوز تشوف كل النتايج زور [الويكي بتاعتنا](https://docs.gofiber.io/extra/benchmarks).
+
+
+
+
+
+
+## ⚙️ التسطيب
+
+أتأكد انك مسطب جو ([تحميل](https://go.dev/dl/)). الاصدار `1.17` او اعلى.
+
+ابدأ البروجكت بتاعك بعمل فولدر وبعدين رن الكوماند ده `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):
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 المميزات
+
+- [راوتنج](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)
+- [APIs](https://docs.gofiber.io/api/ctx)
+- [ميدلويرز](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)
+- [بتدعم الويب سوكتس](https://github.com/gofiber/websocket)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [ريت ليمت](https://docs.gofiber.io/api/middleware/limiter)
+- مترجمة [لـ19 لغة](https://docs.gofiber.io/)
+- وحاجات اكتر, [تصفح فايبر](https://docs.gofiber.io/)
+
+## 💡 الفكرة
+
+الجوفرز الجداد اللي بيسوتشوا من [نود جي اس](https://nodejs.org/en/about/) لـ[جو](https://go.dev/doc/) بيتعاملوا مع مرحلة تعلم قبل ما يبدأوا يبنوا تطبيقاتهم و مايكروسيرفساتهم. فايبر, كـ**ويب فريمورك**, اتعملت بفكرة **البساطة** و بتتبع **طريقة يونكس**, عشان الجوفرز الجداد يقدروا يدخلوا عالم جو بسرعة و بثقة.
+
+فايبر **مستوحاة** من اكسبريس اللي هي اشهر ويب فريمورك عالانترنت. احنا جمعنا بين **سهولة** اكسبريس و **سرعة** جو. لو انت عملت تطبيق ويب في نود جي اس (_باستخدام اكسبريس او حاجة شبهها_), هتلاقي ان معظم الطرق و المبادئ بتاعت فايبر **مألوفة** جدا.
+
+احنا **بنسمع** لمستخدمينا في [الايشوز](https://github.com/gofiber/fiber/issues) و [قناة الديسكورد](https://gofiber.io/discord) و _في كل حتة عالنت_ عشان نعمل فريمورك ويب جو **سريع**, **مرن** و **سهل** **لاي تاسك**, **ديدلاين** واي **مستوى** مبرمج! زي اكسبريس في عالم الجافاسكريبت.
+
+## ⚠️ القيود
+
+- بسبب استخدام فايبر لـunsafe ممكن انها متتوافقش مع اخر اصدار من جو. فايبر 2.40.0 اتتست بـجو من اصدار 1.17 لـ1.21
+- فايبر مش متوافقة مع واجهات net/http. ده يعني انك مش هتقدر تستخدم مشاريع زي gqlgen, go-swagger, او اي حاجة تانية متعلقة بـnet/http
+
+## 👀 أمثلة
+
+دي بعض الامثلة الشائعة. لو عايز تشوف امثلة اكتر, زور [Recipes repository](https://github.com/gofiber/recipes) او زور [API documentation](https://docs.gofiber.io).
+
+#### 📖 [**الراوتنج البسيط**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**تسمية الراوتس**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**ازاي تسيرف فايلات ستاتك**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**الميدلويرز ونيكست**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/list
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 اعرض امثلة اكتر
+
+### محركات الفيوز
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Engines](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+فايبر بتستخدم [html/template](https://pkg.go.dev/html/template/) لما مايكونش في محرك فيوز متعرف
+
+لو عاوز تستخدم فيوز جزئية او محرك فيوز تاني زي [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) او [pug](https://github.com/Joker/jade) وغيره..
+
+بص على [الباكدج](https://github.com/gofiber/template) بتاعنا اللي بيدعم محركات فيوز متعددة
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### تجميع الراوتس في سلسلة
+
+📖 [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
+
+ // ...
+}
+
+```
+
+### ميدل وير لوجر
+
+📖 [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"))
+}
+```
+
+### هيدر الكروس اوريجن (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"))
+}
+```
+
+جرب الCORS بانك تبعت اي دومين في هيدر `Origin` وتشوف الرد بتاع السيرفر
+
+```bash
+curl -H "Origin: http://example.com" --verbose http://localhost:3000
+```
+
+### ريسبومس 404 معدل
+
+📖 [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!")
+ })
+
+ // Last middleware to match anything
+ app.Use(func(c *fiber.Ctx) error {
+ return c.SendStatus(404)
+ // => 404 "Not Found"
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### JSON ريبسونس
+
+📖 [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](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"))
+}
+```
+
+### ميدلوير ريكوفر
+
+📖 [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"))
+}
+```
+
+
+
+### استخدام بروكسي موثوق
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/recover"
+)
+
+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,
+ })
+
+ // ...
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+## 🧬 ميدلوير داخلي
+
+Here is a list of middleware that are included within the Fiber framework.
+دي ليستة بالميدلوير الموجودة في فايبر
+
+| Middleware | Description |
+| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercept and cache responses |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Expose environment variables with providing an optional config. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Allows you to proxy requests to a multiple servers |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [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. |
+
+## 🧬 ميدلوير خارجي
+
+لستة ميدلويرز خارجية بتطور من [تيم فايبر](https://github.com/orgs/gofiber/people).
+
+| Middleware | Description |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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](https://github.com/gofiber/awesome-fiber).
+
+## 👍 شاركنا
+
+لو عاوز تقول **شكرا** او تدعمنا في تطوير `فايبر`:
+
+1. اعمل [GitHub Star](https://github.com/gofiber/fiber/stargazers) للبروجكت.
+2. تويت عن البروجكت [على تويتر](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. اكتب ريفيو او توتوريال على [Medium](https://medium.com/), [Dev.to](https://dev.to/) او البلوج بتاعتك.
+4. او ادعم المشروع [بكوباية شاي](https://buymeacoff.ee/fenny).
+
+## ☕ الداعمين
+
+فايبر مشروع اوبن سورس وشغال على التبرعات عشان ندفع فواتير الدومين والجيت بوك والنتليفاي والسيرفرات. لو عاوز تدعم فايبر تقدر تشتري كوباية شاي من [هنا](https://buymeacoff.ee/fenny).
+
+| | User | Donation |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------- |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/marvinjwendt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Code Contributors
+
+
+
+## ⭐️ Stargazers
+
+
+
+## ⚠️ 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).
+
+**Third-party library licenses**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_es.md b/.github/README_es.md
new file mode 100644
index 0000000..b3e5b9f
--- /dev/null
+++ b/.github/README_es.md
@@ -0,0 +1,687 @@
+
+Fiber es un framework web inspirado en Express construido sobre Fasthttp, el motor HTTP más rápido para Go. Diseñado para facilitar las cosas y tener un menor tiempo de desarrollo con cero asignación de memoria y pensado para un mejor rendimiento.
+
+
+## ⚡️ Inicio rápido
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Puntos de referencia
+
+Estas pruebas son realizadas por [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) y [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Si desea ver todos los resultados, visite nuestra [Wiki](https://docs.gofiber.io/extra/benchmarks).
+
+
+
+
+
+
+## ⚙️ Instalación
+
+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):
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Características
+
+- [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)
+- [Puntos finales de API](https://docs.gofiber.io/api/ctx) Express
+- Middleware y [próximo](https://docs.gofiber.io/api/ctx#next) soporte
+- Programación [rápida](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) del lado del servidor
+- [Template engines](https://github.com/gofiber/template)
+- [WebSocket support](https://github.com/gofiber/websocket)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- Disponible en [19 idiomas](https://docs.gofiber.io/)
+- Y mucho más, [explora Fiber](https://docs.gofiber.io/)
+
+## 💡 Filosofía
+
+Los nuevos gophers que hacen el cambio de [Node.js](https://nodejs.org/en/about/) a [Go](https://go.dev/doc/) están lidiando con una curva de aprendizaje antes de que puedan comenzar a construir sus aplicaciones web o micro-servicios. Fiber, como un **marco web** , fue creado con la idea del **minimalismo** y sigue el **camino de UNIX** , para que los nuevos gophers puedan ingresar rápidamente al mundo de Go con una cálida y confiable bienvenida.
+
+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.17 a 1.21.
+- 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
+
+A continuación se enumeran algunos de los ejemplos comunes. Si desea ver más ejemplos de código, visite nuestro [repositorio de Recetas](https://github.com/gofiber/recipes) o nuestra [documentación de API](https://docs.gofiber.io) .
+
+#### 📖 [**Ruteo Básico**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Sirviendo Archivos Estáticos**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware y Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/register
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 Mostrar más ejemplos de código
+
+### Motores de Vistas
+
+📖 [Configuración](https://docs.gofiber.io/api/fiber#config)
+📖 [Motores](https://github.com/gofiber/template)
+📖 [Renderizado](https://docs.gofiber.io/api/ctx#render)
+
+El motor por defecto de Fiber, cuando no es especificado, es [html/template](https://pkg.go.dev/html/template/).
+
+Si quiere ejecutar vistas parciales, o usar un motor diferente (como [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) o [pug](https://github.com/Joker/jade), etc).
+
+Revise nuestro paquete para [Plantillas](https://github.com/gofiber/template) que soporta múltiples motores de vistas.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Agrupando rutas en cadenas
+
+📖 [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"))
+}
+```
+
+### Intercambio de recursos de origen cruzado (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"))
+}
+```
+
+Revisar CORS, pasando cualquier dominio en el encabezado `Origin`:
+
+```bash
+curl -H "Origin: http://example.com" --verbose http://localhost:3000
+```
+
+### Respuesta 404 personalizada
+
+📖 [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!")
+ })
+
+ // Last middleware to match anything
+ app.Use(func(c *fiber.Ctx) error {
+ return c.SendStatus(404)
+ // => 404 "Not Found"
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Respuesta JSON
+
+📖 [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"))
+}
+```
+
+### Actualización a WebSockets
+
+📖 [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 de Recuperación
+
+📖 [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"))
+}
+```
+
+
+
+## 🧬 Middleware Interno
+
+Aquí está una lista del middleware incluido en el marco web Fiber.
+
+| Middleware | Descripción |
+| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercept and cache responses |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Expose environment variables with providing an optional config. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Allows you to proxy requests to a multiple servers |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [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 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
+
+Lista de módulos de middleware alojados externamente, y mantenidos por el [equipo de Fiber](https://github.com/orgs/gofiber/people).
+
+| Middleware | Descripción |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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).
+
+## 👍 Contribuir
+
+Si quiere **agradecer** y/o apoyar el desarrollo activo de `Fiber`:
+
+1. Agrega una [estrella de GitHub](https://github.com/gofiber/fiber/stargazers) al proyecto.
+2. Tuitea sobre el proyecto [en tu 𝕏 (Twitter)](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Escribe una reseña o tutorial en [Medium](https://medium.com/) , [Dev.to](https://dev.to/) o blog personal.
+4. Apoya el proyecto donando una [tasa de café](https://buymeacoff.ee/fenny).
+
+## ☕ Personas que han mostrado su apoyo
+
+Fiber es un proyecto de código abierto que se mantiene a través de donaciones para pagar las cuentas e.g. nuestro nombre de dominio, gitbook, netlify y hosting serverless. Si quieres apoyar a Fiber, puedes ☕ [**comprar un café**](https://buymeacoff.ee/fenny).
+
+| | User | Donation |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------- |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Contribuyentes de código
+
+
+
+## ⭐️ Stargazers
+
+
+
+## ⚠️ Licencia
+
+Copyright (c) 2019-presente [Fenny](https://github.com/fenny) y [contribuyentes](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` es software libre y de código abierto bajo la licencia [MIT](https://github.com/gofiber/fiber/blob/master/LICENSE). El logo oficial fue creado por [Vic Shóstak](https://github.com/koddr) y distribuido bajo la licencia [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) (CC BY-SA 4.0 International).
+
+**Third-party library licenses**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_fa.md b/.github/README_fa.md
new file mode 100644
index 0000000..390922d
--- /dev/null
+++ b/.github/README_fa.md
@@ -0,0 +1,861 @@
+
+ Fiber الهام گرفته از فریمورک وبExpress است که برپایه Fasthttp ساخته شده است, که سریعترین موتور HTTP برای زبان Go است. طراحی شده است تا با تخصیص حافظه و عملکرد صفر ، کارها را برای توسعه سریع آسان کند.
+
+این تست ها توسط TechEmpower و Go Web انجام شده است. اگر شما تمامی نتایج را می خواهید ببینید, لطفا صفحه ویکی ما را بازدید کنید.
+
+
+
+
+
+
+
+
+
+
+## ⚙️ نصب و راه اندازی
+
+
+
+
+مطمئن شوید Go را نصب (دانلود) کرده اید. نسخه 1.17 یا بیشتر مورد نیاز است.
+پروژه خود را با ساختن یک پوشه و سپس اجرای go mod init github.com/your/repo داخل پوشه (یادگیری بیشتر) راه اندازی کنید. سپس Fiber را با دستور go get نصب کنید :
+
+
+
+
+
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+
+
+
+
+## 🎯 ویژگی ها
+
+
+
+- [مسیریابی](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/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)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- قابلیت [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- ترجمه در [19 زبان](https://docs.gofiber.io/)
+- و امکانات بیشتر, [دیدن در داکیومنت](https://docs.gofiber.io/)
+
+
+
+## 💡 فلسفه
+
+
+
+
+گوفر های جدیدی که از Node.js به Go تغییر می دهند قبل از شروع ساخت برنامه های وب یا میکروسرویس ها با یک منحنی یادگیری رو به رو هستند. Fiber, یک فریمورک وب است و با ایده مینیمالیسم ایجاد شده است و روش های unix را دنبال می کند, بنابرین با استقبال گرم و اعتماد کامل وارد دنیای Go شده است.
+
+Fiber از Express الهام گرفته, که محبوب ترین فریمورک وب روی اینترنت است. ما سادگی Express را با عملکرد بالا زبان Go ترکیب کردیم. اگر شما قبلا یک برنامه وب را در Node.js (با استفاده از Express یا موارد مشابه) پیاده سازی کرده اید. بسیاری از روش ها و اصول ها برای شما ساده به نظر خواهد رسید.
+
+ما در مورد مشکلات کاربران, کانال Discord سراسر دنیا گوش می دهیم و تا بتوانیم یک وب فریم ورک سریع, مطمئن, ساده ایجاد کنیم. درست مثل Express برای برنامه نویس های جاوا اسکریپت.
+
+
+
+
+
+## ⚠️ محدودیت ها
+
+- به دلیل استفاده ناامن از Fiber, ممکن است کتابخانه همیشه با آخرین نسخه Go سازگار نباشد. Fiber 2.40.0 با زبان گو نسخه 1.17 تا 1.21 تست شده است.
+- فریمورک Fiber با پکیج net/http سازگار نیست. این بدان معناست شما نمی توانید از پکیج های مانند go-swagger, gqlgen یا سایر پروژه هایی که بخشی از اکوسیستم net/http هستند استفاده کنید.
+
+
+
+## 👀 مثال ها
+
+
+
+در پایین تعدادی نمونه مثال هستش. اگر شما مثال های بیشتر می خواهید ببینید, لطفا مخزن کد و داکیومنت های ما را بازدید کنید.
+
+Fiber زمانیکه view engine تنظیم نشده باشد بطور پیش فرض از html/template استفاده می کند.
+شما می توانید از موتورهای مختلفی نظیر amber, handlebars, mustache یا pug استفاده کنید.
+پکیج موتورهای پشتیبانی شده را می توانید در اینجا ببینید.
+
+
+
+
+
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+
+
+
+## 🧬 Middleware داخلی
+
+
+
+در اینجا لیستی از middleware های Fiber موجود است.
+
+
+
+
+
+| Middleware | توضیحات |
+| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | یک میدلور پایه که سیستم احراز هویت پایه ای را فراهم میکند. در صورت معتبر بودن درخواست روتر بعدی صدا زده شده و در صورت نامعتبر بودن خطای ۴۰۱ نمایش داده میشود. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | پاسخ هارا رهگیری کرده و انها را به صورت موقت ذخیره میکند. |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | یک میدلور فشرده سازی برای Fiber که به طور پیشفرض از `deflate`, `gzip` و `brotli`. پشتیبانی میکند. | |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | فعال سازی هدر های cross-origin با گزینه های مختلف. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | در برابر حملات CSRF ایمنی ایجاد میکند. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | مقادیر کوکی هارا رمزنگاری میکند. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | با ارائه تنظیمات اختیاری، متغیرهای محیط را در معرض دید قرار دهید. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | میدلور ETag به کش ها اجازه میدهد کارآمد تر عمل کرده و در پهنای باند صرفه جویی کنند. به عنوان یک وب سرور نیازی به دادن پاسخ کامل نیست اگر محتوا تغییر نکرده باشد. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | میدلور Expvar میتواند متغیر هایی را تعریف کرده و مقادیر انها را در زمان اجرا با فرمت JSON به شما نشان دهد. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | جلوگیری و یا کش کردن درخواست های favicon در صورتی که مسیر یک فایل را داده باشید. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | میدلور FileSystem به شما اجازه میدهد فایل های یک مسیر را عمومی کنید. |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | میدلور محدود کننده تعداد درخواست برای Fiber. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | لاگ گرفتن از درخواست و پاسخ های HTTP. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | وضعیت سرور را مانیتور و گزارش میکند، از express-status-monitor الهام گرفته شده است. |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | تشکر ویژه از Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | اجازه میدهد درخواست هارا بر روی چند سرور پروکسی کنید. |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | خطا های زمان اجرا را در وب سرور HTTP شما مدیریت میکنند[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | به تمامی درخواست ها شناسه ای را اختصاص میدهد. |
+| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | برای ذخیره و مدیریت شناسه کاربری یا session بازدید کنندگان استفاده .میشود |
+| [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) | این میدلور احراز هویت مبتنی بر کلید را فراهم می کند. |
+| [redirect](https://github.com/gofiber/redirect) | برای ریدایرکت کردن از این میدلور میتوانید استفاده کنید. |
+| [rewrite](https://github.com/gofiber/rewrite) | مسیر URL را براساس قوانین مشخص شده بازنویسی می کند. این میتواند برای سازگاری با ورژن های قبلی یا برای ساخت لینک های تمیز تر و توصیفی تر مفید باشد. |
+| [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) | با استفاده از HTTP هدر های مختلف به ایمن سازی برنامه شما کمک می کند. |
+
+
+
+
+## 🧬 Middleware خارجی
+
+
+
+لیست middleware های خارجی که توسط [تیم Fiber](https://github.com/orgs/gofiber/people) نگه داری می شود.
+
+
+
+
+
+| Middleware | توضیحات |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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
+
+[awesome list](https://github.com/gofiber/awesome-fiber) برای مقاله، میدلور، مثال ها و ابزار های بیشتر لطفا از این لینک بازدید کنید
+
+
+
+## 👍 مشارکت کنندگان
+
+
+
+اگر شما میخواهید **تشکر** کنید و یا از توسعه فعال Fiber حمایت کنید :
+
+1. یک [GitHub Star](https://github.com/gofiber/fiber/stargazers) به پروژه اضافه کنید.
+2. ارسال توییت درباره Fiber برروی [صفحه توییتر شما](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. یک آموزش یا نظر برروی [Medium](https://medium.com/), [Dev.to](https://dev.to/) یا وبلاگ شخصیتان.
+4. پشتیبانی پروژه با حمایت مالی از طریق [یک فنجان قهوه](https://buymeacoff.ee/fenny).
+
+
+
+## ☕ حامیان مالی
+
+
+
+Fiber یک پروژه متن باز است که با کمک مالی برای پرداخت قبض های دامنه, gitbook, netlify, هاست انجام می شود. اگر می خواهید از Fiber حمایت کنید شما می توانید [**از اینجا یک قهوه بخرید**](https://buymeacoff.ee/fenny).
+
+
+
+| | کاربر | حمایت مالی |
+| :--------------------------------------------------------- | :----------------------------------------------- | :--------- |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/marvinjwendt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+
+
+## 💻 مشارکت کنندگان کد
+
+
+
+
+
+
+
+## ⭐️ ستاره ها
+
+
+
+
+
+
+
+## ⚠️ لایسنس
+
+
+
+
+
+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).
+
+
+ Fiber est un framework web inspiré d' Express. Il se base sur Fasthttp, l'implémentation HTTP de Gola plus rapide. Conçu pour faciliter les choses pour des développements rapides, Fiber garde à l'esprit l'absence d'allocations mémoires, ainsi que les performances.
+
+
+## ⚡️ Quickstart
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Benchmarks
+
+Ces tests sont effectués par [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) et [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Si vous voulez voir tous les résultats, n'hésitez pas à consulter notre [Wiki](https://docs.gofiber.io/extra/benchmarks).
+
+
+
+
+
+
+## ⚙️ Installation
+
+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:
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Features
+
+- [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)
+- [API endpoints](https://docs.gofiber.io/api/ctx)
+- Middleware & [Next](https://docs.gofiber.io/api/ctx#next) support
+- Programmation côté serveur [rapide](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 support](https://github.com/gofiber/websocket)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- Available in [19 languages](https://docs.gofiber.io/)
+- Et plus encore, [explorez Fiber](https://docs.gofiber.io/)
+
+## 💡 Philosophie
+
+Les nouveaux gophers qui passent de [Node.js](https://nodejs.org/en/about/) à [Go](https://go.dev/doc/) sont confrontés à une courbe d'apprentissage, avant de pouvoir construire leurs applications web et microservices. Fiber, en tant que **framework web**, a été mis au point avec en tête l'idée de **minimalisme**, tout en suivant l'**UNIX way**, afin que les nouveaux gophers puissent rapidement entrer dans le monde de Go, avec un accueil chaleureux, de confiance.
+
+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.17 to 1.21.
+- 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
+
+Ci-dessous quelques exemples courants. Si vous voulez voir plus d'exemples, rendez-vous sur notre ["Recipes repository"](https://github.com/gofiber/recipes) ou visitez notre [documentation API](https://docs.gofiber.io).
+
+Listed below are some of the common examples. If you want to see more code examples , please visit our [Recipes repository](https://github.com/gofiber/recipes) or visit our hosted [API documentation](https://docs.gofiber.io).
+
+#### 📖 [**Basic Routing**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Serving Static Files**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware & Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/register
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 Show more code examples
+
+### Views engines
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Engines](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Fiber defaults to the [html/template](https://pkg.go.dev/html/template/) when no view engine is set.
+
+If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
+
+Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Grouping routes into chains
+
+📖 [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"))
+}
+```
+
+Check CORS by passing any domain in `Origin` header:
+
+```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!")
+ })
+
+ // Last middleware to match anything
+ 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 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"))
+}
+```
+
+### Recover middleware
+
+📖 [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"))
+}
+```
+
+
+
+## 🧬 Internal Middleware
+
+Here is a list of middleware that are included within the Fiber framework.
+
+| Middleware | Description |
+| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercept and cache responses |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Expose environment variables with providing an optional config. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Allows you to proxy requests to a multiple servers |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [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 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
+
+List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
+
+| Middleware | Description |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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).
+
+## 👍 Contribuer
+
+Si vous voulez nous remercier et/ou soutenir le développement actif de `Fiber`:
+
+1. Ajoutez une [GitHub Star](https://github.com/gofiber/fiber/stargazers) à ce projet.
+2. Twittez à propos de ce projet [sur votre 𝕏 (Twitter)](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Ecrivez un article (review, tutorial) sur [Medium](https://medium.com/), [Dev.to](https://dev.to/), ou encore un blog personnel.
+4. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
+
+## ☕ Supporters
+
+Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny).
+
+| | User | Donation |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------- |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Code Contributors
+
+
+
+## ⭐️ Stargazers
+
+
+
+## ⚠️ 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).
+
+**Third-party library licenses**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_he.md b/.github/README_he.md
new file mode 100644
index 0000000..0ddda26
--- /dev/null
+++ b/.github/README_he.md
@@ -0,0 +1,865 @@
+
+
+Fiber היא web framework בהשראת Express הבנויה על גבי Fasthttp, מנוע ה-HTTP המהיר ביותר עבור Go.
+נועדה להקל על העניינים למען פיתוח מהיר, ללא הקצאות זכרון ולוקחת ביצועים בחשבון.
+
+
+
+הבדיקות מבוצעות על ידי [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) ו-[Go Web](https://github.com/smallnest/go-web-framework-benchmark). אם אתם רוצים לראות את כל התוצאות, אנא בקרו ב-[Wiki](https://docs.gofiber.io/extra/benchmarks) שלנו.
+
+
+
+
+
+
+
+
+
+
+## ⚙️ התקנה
+
+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:
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 יכולות
+
+
+
+
+
+- [ניתוב](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/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/category/-middleware#template)
+- [תמיכה ב-WebSocket](https://github.com/gofiber/websocket)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [הגבלת קצבים ובקשות](https://docs.gofiber.io/api/middleware/limiter)
+- Available in [12 languages](https://docs.gofiber.io/)
+- והרבה יותר, [חקור את Fiber](https://docs.gofiber.io/)
+
+
+
+
+## 💡 פילוסופיה
+
+
+
+
+
+gophers חדשים שעושים את המעבר מ-[Node.js](https://nodejs.org/en/about/) ל-[Go](https://go.dev/doc/) מתמודדים עם עקומת למידה לפני שהם יכולים להתחיל לבנות את יישומי האינטרנט או המיקרו-שירותים שלהם.
+Fiber כ-**web framework**, נוצרה עם רעיון **המינימליזם** ועוקבת אחרי **הדרך של UNIX**, כך ש-gophers חדשים יוכלו להיכנס במהירות לעולם של Go עם קבלת פנים חמה ואמינה.
+
+
+
+
+
+Fiber נוצרה **בהשראת** Express, ה-web framework הפופולרית ביותר ברחבי האינטרנט. שילבנו את **הקלות** של Express ו**הביצועים הגולמיים** של Go. אם אי-פעם מימשתם יישום web ב-Node.js (_באמצעות Express או דומיו_), אז הרבה מהפונקציות והעקרונות ייראו לכם **מאוד מוכרים**.
+
+
+
+
+
+אנחנו **מקשיבים** למשתמשים שלנו ב-[issues](https://github.com/gofiber/fiber/issues) (_ובכל רחבי האינטרנט_) כדי ליצור web framework **מהירה**, **גמישה**, ו**ידידותית** בשפת 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.17 to 1.21.
+- 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.
+
+## 👀 דוגמאות
+
+
+
+
+
+להלן כמה מהדוגמאות הנפוצות. אם ברצונכם לראות דוגמאות קוד נוספות, אנא בקרו ב[מאגר המתכונים](https://github.com/gofiber/recipes) שלנו או בקרו ב[תיעוד ה-API](https://docs.gofiber.io) שלנו.
+
+
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/register
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+
+ 📚 הצג דוגמאות קוד נוספות
+
+### Views engines
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Engines](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Fiber defaults to the [html/template](https://pkg.go.dev/html/template/) when no view engine is set.
+
+If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
+
+Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
+
+
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+### קיבוץ routes ל-chains
+
+📖 [קבוצות](https://docs.gofiber.io/api/app#group)
+
+
+
+Here is a list of middleware that are included within the Fiber framework.
+
+
+
+
+
+| Middleware | Description |
+| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercept and cache responses |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Expose environment variables with providing an optional config. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Allows you to proxy requests to a multiple servers |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [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 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
+
+
+
+
+
+Here is a list of middleware that are included within the Fiber framework.
+
+
+
+
+
+| Middleware | Description |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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).
+
+
+
+
+
+## 👍 לתרום
+
+
+
+
+
+אם אתם רוצים לומר **תודה** או/ו לתמוך בפיתוח הפעיל של `Fiber`:
+
+
+
+
+
+1. תוסיפו [GitHub Star](https://github.com/gofiber/fiber/stargazers) לפרויקט.
+2. צייצו לגבי הפרויקט [בטוויטר שלכם](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. כתבו ביקורת או מדריך ב-[Medium](https://medium.com/), [Dev.to](https://dev.to/) או בבלוג האישי שלכם.
+4. תמכו בפרויקט על ידי תרומת [כוס קפה](https://buymeacoff.ee/fenny).
+
+
+
+
+## ☕ תומכים
+
+
+
+
+
+Fiber היא פרויקט קוד פתוח שתשלום חשובונתיו מסתמך על תרומות, כגון שם ה-domain שלנו, gitbook, netlify ו-serverless hosting. אם אתם רוצים לתמוך ב-Fiber, אתם יכולים ☕ [**קנו קפה כאן**](https://buymeacoff.ee/fenny).
+
+
+
+| | משתמש | תרומה |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------ |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+
+
+## 💻 תורמי קוד
+
+
+
+
+
+
+
+## ⭐️ Stargazers
+
+
+
+
+
+
+
+## ⚠️ רישיון
+
+
+
+
+
+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).
+
+
+ Fiber adalah kerangka kerja web yang terinspirasi dari Express yang berbasiskan Fasthttp, HTTP engine paling cepat untuk Go. Dirancang untuk mempermudah, mempercepat pengembangan aplikasi dengan alokasi memori nol-nya serta kinerja yang selalu diperhatikan.
+
+
+## ⚡️ Cara Memulai
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Pengukuran Kinerja
+
+Pengukuran ini dilakukan oleh [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) dan [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Apabila anda ingin melihat hasil lengkapnya, silahkan kunjungi halaman [Wiki](https://docs.gofiber.io/extra/benchmarks) kami.
+
+
+
+
+
+
+## ⚙️ Instalasi
+
+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):
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Fitur
+
+- 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
+- Cocok untuk [API](https://docs.gofiber.io/api/ctx)
+- Mendukung Middleware & [Next](https://docs.gofiber.io/api/ctx#next) seperti Express
+- Kembangkan aplikasi dengan [Cepat](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)
+- [Mendukung WebSocket](https://github.com/gofiber/websocket)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- Tersedia dalam [19 bahasa](https://docs.gofiber.io/)
+- Dan masih banyak lagi, [kunjungi Fiber](https://docs.gofiber.io/)
+
+## 💡 Filosofi
+
+Bagi yang baru yang beralih dari [Node.js](https://nodejs.org/en/about/) ke [Go](https://go.dev/doc/) terkadang perlu waktu yang cukup lama sebelum mereka mampu membuat aplikasi web dengan Go. Fiber, sebagai **kerangka kerja web** dirancang secara **minimalis** dan mengikuti filosofi dari **UNIX**, sehingga pengguna baru dapat dengan cepat memasuki dunia Go dengan sambutan yang hangat dan dapat diandalkan.
+
+Fiber terinspirasi dari Express, salah satu kerangka kerja web yang paling terkenal di Internet. Kami menggabungkan **kemudahan** dari Express dan **kinerja luar biasa** dari Go. Apabila anda pernah membuat aplikasi dengan Node.js (_dengan Express atau yang lainnya_), maka banyak metode dan prinsip yang akan terasa **sangat umum** bagi anda.
+
+Kami **mendengarkan** para pengguna di [GitHub Issues](https://github.com/gofiber/fiber/issues), Discord [channel](https://gofiber.io/discord), _dan berbagai platform lainnya_ untuk menciptakan kerangka kerja web yang **cepat**, **fleksibel** dan **bersahabat** untuk berbagai macam keperluan, **tenggat waktu** dan **keahlian** para pengguna! Sama halnya seperti yang dilakukan Express di dunia JavaScript.
+
+## ⚠️ 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.17 hingga 1.21.
+- 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
+
+Dibawah ini terdapat beberapa contoh penggunaan. Jika anda ingin melihat contoh lainnya, silahkan kunjungi [Gudang resep](https://github.com/gofiber/recipes) atau kunjungi [Dokumentasi API](https://docs.gofiber.io) kami.
+
+#### 📖 [**Routing Dasar**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Penamaan Route**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Menyajikan File Statis**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware & Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/register
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 Tampilkan lebih banyak contoh kode
+
+### Views engines
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Engines](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Fiber mengalihkan ke [html/template](https://pkg.go.dev/html/template/) saat tidak ada mesin tampilan yang disetel.
+
+Jika kamu ingin menjalankan sebagian atau menggunakan mesin yang berbeda seperti [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) atau [pug](https://github.com/Joker/jade) dan lain-lain..
+
+Lihat paket [contoh](https://github.com/gofiber/template) kami yang mendukung beberapa mesin tampilan.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Grouping routes into chains
+
+📖 [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"))
+}
+```
+
+Periksa CORS dengan meneruskan domain apa pun di `Origin` header:
+
+```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!")
+ })
+
+ // Last middleware to match anything
+ 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 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
+
+📖 [Informasi lebih lanjut](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"))
+}
+```
+
+### Recover middleware
+
+📖 [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"))
+}
+```
+
+
+
+## 🧬 Middleware Internal
+
+Kumpulan `middleware` yang ada didalam kerangka kerja Fiber.
+
+| Middleware | Description |
+| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercept and cache responses |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Expose environment variables with providing an optional config. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Allows you to proxy requests to a multiple servers |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [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 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
+
+Kumpulan `middleware` yang dihost external dan diurus oleh [Tim Fiber](https://github.com/orgs/gofiber/people).
+
+| Middleware | Description |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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
+
+Untuk artikel lainnya, middlewares, contoh atau tools check kami [awesome list](https://github.com/gofiber/awesome-fiber).
+
+## 👍 Berkontribusi
+
+Apabila anda ingin mengucapkan **terima kasih** dan/atau mendukung pengembangan `Fiber`:
+
+1. Berikan bintang atau [GitHub Star](https://github.com/gofiber/fiber/stargazers) ke proyek ini.
+2. Bagikan [di 𝕏 (Twitter) anda](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Buat ulasan atau tutorial di [Medium](https://medium.com/), [Dev.to](https://dev.to/) atau blog pribadi anda.
+4. Dukung proyek ini dengan membelikan [secangkir kopi](https://buymeacoff.ee/fenny).
+
+## ☕ Pendukung
+
+Fiber adalah proyek sumber terbuka yang beroperasi dalam donasi untuk membayar tagihan, seperti nama domain, _gitbook, netlify_ dan _serverless hosting_. Jika anda mau mendukung Fiber, anda dapat [**membelikan kami kopi disini**](https://buymeacoff.ee/fenny).
+
+| | User | Donation |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------- |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Kontributor Kode
+
+
+
+## ⭐️ Pengamat bintang
+
+
+
+## ⚠️ Lisensi
+
+Copyright (c) 2019-sekarang [Fenny](https://github.com/fenny) dan [Kontributor](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` adalah proyek gratis dan open-source dibawah [lisensi MIT](https://github.com/gofiber/fiber/blob/master/LICENSE). Logo resmi diciptakan oleh [Vic Shóstak](https://github.com/koddr) dan didistribusikan dalam lisensi [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) (CC BY-SA 4.0 International).
+
+**Lisensi perpustakaan pihak-ketiga**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_it.md b/.github/README_it.md
new file mode 100644
index 0000000..159bcff
--- /dev/null
+++ b/.github/README_it.md
@@ -0,0 +1,712 @@
+
+Fiber è un framework web inspirato a Express costruito sopra Fasthttp, un motore HTTP molto veloce per Go. Progettato per semplificare le cose per uno sviluppo veloce con zero allocazione di memoria e le prestazioni in mente.
+
+
+## ⚡️ Inizia velocemente
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Benchmark
+
+Questi test sono stati eseguiti da [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) e [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Se vuoi vedere tutti i risultati, visita la nostra [Wiki](https://docs.gofiber.io/extra/benchmarks).
+
+
+
+
+
+
+## ⚙️ Installazione
+
+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):
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Caratteristiche
+
+- [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)
+- [API endpoints](https://docs.gofiber.io/api/ctx)
+- Supporta Middleware e [Next](https://docs.gofiber.io/api/ctx#next)
+- Programmazione server-side [veloce](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497)
+- [Template engine](https://github.com/gofiber/template)
+- [Supporto WebSocket](https://github.com/gofiber/websocket)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- Disponible in [19 lingue](https://docs.gofiber.io/)
+- E molto altro ancora, [esplora Fiber](https://docs.gofiber.io/)
+
+## 💡 Filosofia
+
+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 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.17 alla 1.21 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
+
+Qui sotto trovi molti dei più comuni esempi. Se vuoi vedere ulteriori esempi, visita il nostro [repository delle ricette](https://github.com/gofiber/recipes) o la nostra [documentazione API](https://docs.gofiber.io) .
+
+#### 📖 [**Routing di base**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Dare nomi alle Route**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Servire File Statici**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware e Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/register
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 Mostra altri esempi
+
+### Motori di template
+
+📖 [Configurazione](https://docs.gofiber.io/api/fiber#config)
+📖 [Motori](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Fiber usa di default [html/template](https://pkg.go.dev/html/template/) quando nessun motore template è stato impostato.
+
+Se vuoi eseguire parzialmente o utilizzare un motore differente come [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) o [pug](https://github.com/Joker/jade) ecc..
+
+Dai un'occhiata al pacchetto [Template](https://github.com/gofiber/template) che supporta multipli motore template.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Raggruppare le route
+
+📖 [Gruppi](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"))
+}
+```
+
+Controlla il CORS passando un dominio qualsiasi nell'header `Origin`:
+
+```bash
+curl -H "Origin: http://example.com" --verbose http://localhost:3000
+```
+
+### Risposte 404 personalizzate
+
+📖 [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!")
+ })
+
+ // Last middleware to match anything
+ app.Use(func(c *fiber.Ctx) error {
+ return c.SendStatus(404)
+ // => 404 "Not Found"
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Risposte JSON
+
+📖 [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
+
+📖 [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
+}
+```
+
+### Eventi dal server
+
+📖 [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"))
+}
+```
+
+### Recupera middleware
+
+📖 [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"))
+}
+```
+
+
+
+### Utilizzare i Proxy fidati
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/recover"
+)
+
+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,
+ })
+
+ // ...
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+## 🧬 Middleware Interni
+
+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 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) | 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) | 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 è 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) | 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 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) | 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
+
+La lista dei moduli middleware hostati esternamente e mantenuti dal [team di Fiber](https://github.com/orgs/gofiber/people).
+
+| Middleware | Descrizione |
+| :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | Usa JSON Web Token \(JWT\) auth. |
+| [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! |
+
+## 🕶️ Awesome List
+
+Per piu articoli, middlewares, esempi o attrezzi puoi usare la [awesome list](https://github.com/gofiber/awesome-fiber).
+
+## 👍 Contribuire
+
+Se vuoi dirci **grazie** e/o supportare lo sviluppo di `Fiber`:
+
+1. Aggiungi una [stella GitHub](https://github.com/gofiber/fiber/stargazers) al progetto.
+2. Twitta del progetto [su 𝕏 (Twitter)](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Scrivi una recensione o un tutorial su [Medium](https://medium.com/), [Dev.to](https://dev.to/) o sul tuo blog personale.
+4. Supporta il progetto donando una [tazza di caffè](https://buymeacoff.ee/fenny).
+
+## ☕ Supporter
+
+Fiber è un progetto open source che va avanti grazie alle donazioni per pagare le spese e.g. il nostro nome dominio, gitbook, netlify e hosting serverless. Se vuoi supportare Fiber, puoi ☕ [**comprarci un caffè qui**](https://buymeacoff.ee/fenny).
+
+| | Utente | Donazione |
+| :--------------------------------------------------------- | :----------------------------------------------- | :-------- |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/marvinjwendt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Contributori
+
+
+
+## ⭐️ Stargazers
+
+
+
+## ⚠️ Licenza
+
+Copyright (c) 2019-ora [Fenny](https://github.com/fenny) e [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` è un software free e open-source licenzato sotto [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Il logo ufficiale è stato creato da [Vic Shóstak](https://github.com/koddr) e distribuito sotto licenza [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) (CC BY-SA 4.0 International).
+
+**Licenze di Terze parti **
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_ja.md b/.github/README_ja.md
new file mode 100644
index 0000000..23dfb60
--- /dev/null
+++ b/.github/README_ja.md
@@ -0,0 +1,691 @@
+
+ Fiber is een web framework geïnspireerd door Express gebouwd bovenop Fasthttp, de snelste HTTP-engine voor Go. Ontworpen om snelle ontwikkeling gemakkelijker te maken zonder geheugenallocatie tezamen met hoge prestaties.
+
+
+## ⚡️ Bliksemsnelle start
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Benchmarks
+
+Deze tests zijn uitgevoerd door [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) en [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Bezoek onze [Wiki](https://fiber.wiki/benchmarks) voor alle benchmark resultaten.
+
+
+
+
+
+
+## ⚙️ Installatie
+
+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:
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Features
+
+- 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/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/category/-middleware/limiter)
+- Vertaald in [19 talen](https://docs.gofiber.io/)
+- En nog veel meer, [ontdek Fiber](https://docs.gofiber.io/)
+
+## 💡 Filosofie
+
+Nieuwe gophers die de overstap maken van [Node.js](https://nodejs.org/en/about/) naar [Go](https://go.dev/doc/), hebben te maken met een leercurve voordat ze kunnen beginnen met het bouwen van hun webapplicaties of microservices. Fiber, als een **web framework**, is gebouwd met het idee van **minimalisme** en volgt de **UNIX-manier**, zodat nieuwe gophers snel de wereld van Go kunnen betreden met een warm en vertrouwd welkom.\
+
+Fiber is **geïnspireerd** door Express, het populairste webframework op internet. We hebben het **gemak** van Express gecombineerd met de **onbewerkte prestaties** van Go. Als je ooit een webapplicatie in Node.js hebt geïmplementeerd (_zoals Express of vergelijkbaar_), dan zullen veel methoden en principes **heel gewoon** voor je lijken.
+
+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.17 to 1.21.
+- 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
+
+Hieronder staan enkele van de meest voorkomende voorbeelden.
+
+> Bekijk ons [Recepten repository](https://github.com/gofiber/recipes) voor meer voorbeelden met code of bezoek onze [API documentatie](https://fiber.wiki).
+
+Listed below are some of the common examples. If you want to see more code examples , please visit our [Recipes repository](https://github.com/gofiber/recipes) or visit our hosted [API documentation](https://docs.gofiber.io).
+
+#### 📖 [**Basic Routing**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Serving Static Files**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware & Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/register
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 Show more code examples
+
+### Views engines
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Engines](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Fiber defaults to the [html/template](https://pkg.go.dev/html/template/) when no view engine is set.
+
+If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
+
+Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Grouping routes into chains
+
+📖 [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"))
+}
+```
+
+Check CORS by passing any domain in `Origin` header:
+
+```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!")
+ })
+
+ // Last middleware to match anything
+ 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 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"))
+}
+```
+
+### Recover middleware
+
+📖 [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"))
+}
+```
+
+
+
+## 🧬 Internal Middleware
+
+Here is a list of middleware that are included within the Fiber framework.
+
+| Middleware | Description |
+| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercept and cache responses |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Expose environment variables with providing an optional config. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Allows you to proxy requests to a multiple servers |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [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 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
+
+List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
+
+| Middleware | Description |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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).
+
+## 👍 Bijdragen
+
+Om de actieve ontwikkelingen van `Fiber` te ondersteunen of om een **bedankje** te geven:
+
+1. Voeg een [GitHub Star](https://github.com/gofiber/fiber/stargazers) toe aan het project.
+2. Tweet over het project [op je 𝕏 (Twitter) account](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Schrijf een recensie of tutorial op [Medium](https://medium.com/), [Dev.to](https://dev.to/) of een persoonlijke blog.
+4. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
+
+## ☕ Supporters
+
+Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny).
+
+| | User | Donation |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------- |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Code Contributors
+
+
+
+## ⭐️ Stargazers
+
+
+
+## ⚠️ 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).
+
+**Third-party library licenses**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_pl.md b/.github/README_pl.md
new file mode 100644
index 0000000..5cff10c
--- /dev/null
+++ b/.github/README_pl.md
@@ -0,0 +1,715 @@
+
+ Fiber jest frameworkiem webowym inspirowanym javascriptowym frameworkiem Express. Został zbudowany na podstawie Fasthttp, najszybszym silniku HTTP powstałym w Go. Został zaprojektowany tak, aby ułatwić szybkie programowanie
+z myślą o wydajności oraz zerowej alokacji pamięci.
+
+
+## ⚡️ Szybki start
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Testy wydajności
+Testy te zostały przeprowadzone przez [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) oraz [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Jeżeli chcesz zobaczyć wszystkie wyniki, proszę, odwiedź naszą [Wiki](https://docs.gofiber.io/extra/benchmarks).
+
+
+
+
+
+
+
+## ⚙️ Instalacja
+
+Upewnij się, że masz zainstalowane Go ([pobierz](https://go.dev/dl/)). Wymagana jest wersja `1.17` lub wyższa.
+
+Zainicjalizuj swój projekt poprzez stworzenie folderu i użycie komendy `go mod init github.com/your/repo` ([zobacz więcej](https://go.dev/blog/using-go-modules)) w tym folderze. Następnie zainstaluj Fiber'a przy użyciu komendy `go get`:
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Funkcjonalności
+
+- Stabilny [routing](https://docs.gofiber.io/guide/routing)
+- Serwowanie [pliki statyczne](https://docs.gofiber.io/api/app#static)
+- Ekstremalna [wydajność](https://docs.gofiber.io/extra/benchmarks)
+- [Niskie zużycie](https://docs.gofiber.io/extra/benchmarks) pamięci
+- [Endpointy API](https://docs.gofiber.io/api/ctx)
+- Wsparcie [Middleware](https://docs.gofiber.io/category/-middleware) oraz [Next](https://docs.gofiber.io/api/ctx#next)
+- [Szybkie](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) programowanie po stronie servera
+- [Silniki szablonów HTML](https://github.com/gofiber/template)
+- [Wsparcie WebSocket](https://github.com/gofiber/websocket)
+- [Wydarzenia wysyłane przez serwer](https://github.com/gofiber/recipes/tree/master/sse)
+- [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- Tłumaczenia w [20 językach](https://docs.gofiber.io/)
+- Oraz wiele więcej, [odkryj Fiber'a](https://docs.gofiber.io/)
+
+## 💡 Nasza filozofia
+Nowi gophersi, którzy przenoszą się z [Node.js](https://nodejs.org/en/about/) na [Go](https://go.dev/doc/), mierzą się z problemami nauczania, zanim będą mogli rozpocząć budowanie swoich aplikacji internetowych lub mikroserwisów. Fiber, jako framework, został stworzony z myślą o minimalizmie i podąża za filozofią UNIX, aby nowi programiści w Go mogli szybko wkroczyć do świata Go, ciesząc się serdecznym i godnym zaufania przyjęciem.
+
+Fiber jest **inspirowany** javascriptowym frameworkiem Express, najpopularniejszym frameworkiem webowym w internecie. Połączyliśmy **łatwość** Express'a z **czystą wydajnością** Go. Jeżeli kiedykolwiek tworzyłeś aplikację webową w Node.js (_korzystając z Express'a lub podobnych_), wtedy wiele metod i zasad będzie dla ciebie **bardzo znajomych**.
+
+
+**Słuchamy** naszych użytkowników w [issues](https://github.com/gofiber/fiber/issues), na kanale [Discord](https://gofiber.io/discord) _i wszędzie w Internecie_, aby stworzyć **szybki**, **elastyczny** i **przyjazny** framework webowy dla Go, który nadaje się do **wszelkich** zadań, **terminów** i **umiejętności** programistów! Tak jak Express w świecie JavaScript.
+
+## ⚠️ Ograniczenia
+
+- Z uwagi na użycie unsafe przez Fiber'a, biblioteka nie zawsze będzie kompatybilna z najnowszą wersją Go. Fiber 2.40.0 został przetestowany z Go w wersjach 1.17 i 1.21.
+- Fiber nie jest kompatybilny z interfejsami net/http. To oznacza, że nie będziesz w stanie korzystać (bezpośrednio) z projektów takich jak gqlgen, go-swagger lub innych, które są częścią ekosystemu net/http.
+
+
+## 👀 Przykłady
+
+
+Poniżej znajdują się niektóre przykłady. Jeśli chcesz zobaczyć więcej przykładów kodu, odwiedź nasze [repozytorium Recipes](https://github.com/gofiber/recipes) lub odwiedź naszą [dokumentację API](https://docs.gofiber.io).
+
+#### 📖 [**Podstawowy Routing**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Nazywanie Route'ów**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Serwowanie plików statycznych**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware i Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/list
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 Pokaż więcej przykładów
+
+### Silniki widoków
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Silniki](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Fiber domyślnie korzysta z [html/template](https://pkg.go.dev/html/template/), kiedy nie wybrano żadnego silnika.
+
+Jeżeli chcesz wykonywać lub korzystać z innego silnika jak [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache), [pug](https://github.com/Joker/jade) itd. sprawdź naszą paczkę [Template](https://github.com/gofiber/template), która wspiera wiele silników widoków.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Grupowanie route'ów w łańcuchy
+
+📖 [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"))
+}
+```
+Sprawdź CORS poprzez przesłanie jakiejkolwiek domeny w nagłówku `Origin`:
+
+```bash
+curl -H "Origin: http://example.com" --verbose http://localhost:3000
+```
+
+### Niestandardowa odpowiedź 404
+
+📖 [Metody HTTP](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!")
+ })
+
+ // Last middleware to match anything
+ app.Use(func(c *fiber.Ctx) error {
+ return c.SendStatus(404)
+ // => 404 "Not Found"
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Odpowiedź JSON
+
+📖 [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"))
+}
+```
+
+### Dodanie WebSocket
+
+📖 [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
+}
+```
+
+### Wydarzenia wysyłane przez serwer
+
+📖 [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 Recover
+
+📖 [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"))
+}
+```
+
+
+
+### Używanie zaufanego proxy
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/recover"
+)
+
+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,
+ })
+
+ // ...
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+## 🧬 Wbudowane Middleware
+
+Poniżej znajduje się lista middleware, które są zawarte wraz z frameworkiem Fiber.
+
+| Middleware | Opis |
+| :------------------------------------------------------------------------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Podstawowe middleware zapewniające podstawowe uwierzytelnienie HTTP. Wywołuje ono handler Next dla poprawnych danych uwierzytelniających oraz 401 Unauthorized dla niepoprawnych lub brakujacych danych. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Przechwytuje i cache'uje odpowiedzi |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Middleware kompresji dla Fiber'a, podstawowo wspiera `deflate`, `gzip` i `brotli`. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Zezwala na cross-origin resource sharing \(CORS\) z wieloma opcjami konfiguracji. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Chroni przed exploitami CSRF. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Middleware szyfrujące wartości ciasteczek. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Odsłania zmienne środowiskowe oraz zapewnia dodatkową konfigurację. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | Middleware ETag, które pozwala cache być bardziej wydajnym i oszczędzać transfer danych, jako, że serwer web nie musi wysyłać pełnej odpowiedzi, jeżeli dane się nie zmieniły. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Middleware Expvar, które udostępnia warianty uruchomieniowe przez swój serwer HTTP, w formacie JSON |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignoruje favicony z logów lub serwuje je z pamięci, gdy ścieżka do pliku została podana |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | Logger zapytań/odpowiedzi HTTP. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Middleware Monitor, które reportuje metryki serwera, inspirowane express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Specjalne podziękowania dla Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Pozwala ci przesyłać zapytania dalej do wielu serwerów |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Middleware Recover przywraca działanie po wystąpieniu awarii w dowolnym miejscu w programie i przekazuje kontrolę do scentralizowanego typu [ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | Dodaje requestid do każdego zapytania. |
+| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Middleware sesji. UWAGA: To middleware korzysta z naszej paczki Storage |
+| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Middleware skip, które pomija opakowany handler, jeżeli założona zasada jest spełniona |
+| [rewrite](https://github.com/gofiber/rewrite) | Middleware Rewrite przepisuje scieżkę URL bazując na podanych zasadach. Może być przydatne w przypadku potrzeby kompatybilności wstecznej lub po prostu tworzeniu czystszych i bardziej przejrzystych linków. |
+| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Dodaje maksymalny czas dla zapytania i podaje go dalej do ErrorHandler, gdy limit został przekroczony. |
+| [adaptor](https://github.com/gofiber/adaptor) | Konwertuje handlery net/http do/z zapytania Fiber'a, specjalne podziękowania dla @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Pomaga zabezpieczyć twoją aplikację poprzez ustawianie wielu nagłówków HTTP. |
+| [redirect](https://github.com/gofiber/redirect) | Middleware przekierowywujące |
+| [keyauth](https://github.com/gofiber/keyauth) | Middleware Key auth zapewnia uwierzytelnienie na podstawie klucza. |
+
+## 🧬 Zewnętrzne middleware
+Lista zewnętrznie hostowanych modułów middleware i utrzymywanych przez [zpesół Fiber'a](https://github.com/orgs/gofiber/people).
+
+| Middleware | Description |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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
+
+Po więcej artykułów, middleware, przykładów lub narzędzi sprawdź naszą [awesome list](https://github.com/gofiber/awesome-fiber).
+
+## 👍 Wspomaganie
+
+Jeżeli chcesz podziękować i/lub wesprzeć aktywny rozwój `Fiber'a`:
+
+1. Dodaj [Gwiazdkę GitHub](https://github.com/gofiber/fiber/stargazers) dla tego projektu.
+2. Zatweetuj o tym projekcie [na twoim 𝕏 (Twitter)](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Napisz recenzję lub tutorial na [Medium](https://medium.com/), [Dev.to](https://dev.to/) lub personalnym blogu.
+4. Wesprzyj projekt, przekazując darowiznę w postaci [filiżanki kawy](https://buymeacoff.ee/fenny).
+
+## ☕ Wspierający
+
+Fiber to projekt open source, który działa dzięki darowiznom, aby pokryć koszty, takie jak nasza nazwa domeny, GitBook, Netlify oraz hosting serverless. Jeśli chcesz wesprzeć Fiber, możesz ☕ [**tutaj kupić kawę**](https://buymeacoff.ee/fenny).
+
+| | Użytkownik | Dotacja |
+| :--------------------------------------------------------- |:-------------------------------------------------|:--------|
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/marvinjwendt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Współtwórcy projektu
+
+
+
+## ⭐️ Obserwujący projekt
+
+
+
+## ⚠️ Licencja
+
+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).
+
+**Licencje bibliotek od innych twórców**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_pt.md b/.github/README_pt.md
new file mode 100644
index 0000000..e55f4f5
--- /dev/null
+++ b/.github/README_pt.md
@@ -0,0 +1,689 @@
+
+Fiber é um framework web inspirado no Express, construído sobre o Fasthttp, o motor HTTP mais rápido do Go. Projetado para facilitar e acelerar o desenvolvimento, com zero de alocação de memória e desempenho em mente.
+
+
+## ⚡️ Início rápido
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Benchmarks
+
+Esses testes são realizados pelo [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) e [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Se você quiser ver todos os resultados, visite nosso [Wiki](https://docs.gofiber.io/extra/benchmarks) .
+
+
+
+
+
+
+## ⚙️ Instalação
+
+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):
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Recursos
+
+- [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)
+- [API de rotas](https://docs.gofiber.io/api/ctx)
+- Suporte à Middleware e [Next](https://docs.gofiber.io/api/ctx#next)
+- Programação [rápida](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) de aplicações de servidor
+- [Templates](https://github.com/gofiber/template)
+- [Suporte à WebSockets](https://github.com/gofiber/websocket)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [Limitador de requisições](https://docs.gofiber.io/api/middleware/limiter)
+- Disponível em [19 línguas](https://docs.gofiber.io/)
+- E muito mais, [explore o Fiber](https://docs.gofiber.io/)
+
+## 💡 Filosofia
+
+Os novos gophers que mudaram do [Node.js](https://nodejs.org/en/about/) para o [Go](https://go.dev/doc/) estão tendo que lidar com uma curva de aprendizado antes que possam começar a criar seus aplicativos web ou microsserviços. O Fiber, como um **framework web**, foi criado com a ideia de ser **minimalista** e seguindo a **filosofia UNIX**, para que novos gophers possam, rapidamente, entrar no mundo do Go com uma recepção calorosa e confiável.
+
+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ê.
+
+## ⚠️ Limitações
+
+- Devido ao uso de "unsafe" pelo Fiber, a biblioteca pode nem sempre ser compatível com a última versão do Go. Fiber 2.40.0 foi testado com as versões Go de 1.17 a 1.21.
+- Fiber não é compatível com as interfaces net/http. Isso significa que você não poderá usar projetos como gqlgen, go-swagger ou quaisquer outros que fazem parte do ecossistema net/http.
+
+## 👀 Exemplos
+
+Listados abaixo estão alguns exemplos comuns. Se você quiser ver mais exemplos de código,
+visite nosso [repositório de receitas](https://github.com/gofiber/recipes) ou
+a [documentação da API](https://docs.gofiber.io).
+
+#### 📖 [**Roteamento básico**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Nome de Rotas**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Servindo arquivos estáticos**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware & Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/register
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 Mostrar mais exemplos
+
+### Engines de visualização
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Engines](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+O Fiber usa por padrão o [html/template](https://pkg.go.dev/html/template/) quando nenhuma engine é selecionada.
+
+Se você quiser uma execução parcial ou usar uma engine diferente como [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) ou [pug](https://github.com/Joker/jade) etc.. Dê uma olhada no package [Template](https://github.com/gofiber/template) que suporta multiplas engines de visualização.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Agrupamento de rotas
+
+📖 [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"))
+}
+```
+
+Verifique o CORS passando qualquer domínio no header `Origin`:
+
+```bash
+curl -H "Origin: http://example.com" --verbose http://localhost:3000
+```
+
+### Resposta 404 customizada
+
+📖 [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!")
+ })
+
+ // Last middleware to match anything
+ app.Use(func(c *fiber.Ctx) error {
+ return c.SendStatus(404)
+ // => 404 "Not Found"
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Resposta JSON
+
+📖 [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
+
+📖 [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 Recover
+
+📖 [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"))
+}
+```
+
+
+
+## 🧬 Middleware Interno
+
+Aqui está uma lista de middlewares que estão incluídos no framework Fiber.
+
+| Middleware | Descrição |
+| :------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Autenticação básica fornece uma autenticação HTTP básica. Ele chama o próximo manipulador para credenciais válidas e 401 Não Autorizado para credenciais ausentes ou inválidas. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercepta e armazena em cache as respostas |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Middleware de compressão para o Fiber, suporta `deflate`, `gzip` e `brotli` por padrão. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Habilita o compartilhamento de recursos de origem cruzada (CORS) com várias opções. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protege contra exploits CSRF. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Criptografa valores de cookie. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Expõe variáveis de ambiente fornecendo uma configuração opcional. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | Permite que caches sejam mais eficientes e economizem largura de banda, pois um servidor web não precisa reenviar uma resposta completa se o conteúdo não mudou. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Serve via seu servidor HTTP variantes expostas em tempo de execução no formato JSON. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignora favicon dos logs ou serve da memória se um caminho de arquivo for fornecido. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | Sistema de Arquivos para o Fiber, agradecimentos especiais e créditos a Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Limitação de taxa para o Fiber. Use para limitar solicitações repetidas para APIs públicas e/ou endpoints como redefinição de senha. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | Logger de solicitação/resposta HTTP. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Middleware de monitoramento que relata métricas do servidor, inspirado pelo express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Agradecimentos especiais a Matthew Lee (@mthli) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Permite que você faça proxy de solicitações a vários servidores |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recupera de panics em qualquer lugar da cadeia de chamadas e passa o controle para o [ErrorHandler](https://docs.gofiber.io/guide/error-handling) centralizado. |
+| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | Adiciona um ID de solicitação a cada pedido. |
+| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Middleware de sessão. NOTA: Este middleware usa nosso pacote Storage. |
+| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Pula um handler envolto se um predicado for verdadeiro. |
+| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adiciona um tempo máximo para uma solicitação e encaminha para ErrorHandler se ele for excedido. |
+| [keyauth](https://github.com/gofiber/keyauth) | Autenticação por chave fornece uma autenticação baseada em chave. |
+| [redirect](https://github.com/gofiber/redirect) | Middleware de redirecionamento |
+| [rewrite](https://github.com/gofiber/rewrite) | Reescreve o caminho da URL com base nas regras fornecidas. Pode ser útil para compatibilidade retroativa ou para criar links mais limpos e descritivos. |
+| [adaptor](https://github.com/gofiber/adaptor) | Conversor para handlers net/http para/para manipuladores de solicitação Fiber, agradecimentos especiais ao @arsmn! |
+| [helmet](https://github.com/gofiber/helmet) | Ajuda a proteger seus aplicativos definindo vários cabeçalhos HTTP. |
+
+## 🧬 Middleware Externo
+
+Lista de módulos de middleware hospedados externamente e mantidos pela [equipe Fiber](https://github.com/orgs/gofiber/people).
+
+| Middleware | Descrição |
+| :------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT retorna um middleware de autenticação com tokens JWT. |
+| [storage](https://github.com/gofiber/storage) | Drivers de armazenamento prontos que implementam a interface Storage, projetados para serem usados com vários middlewares do Fiber. |
+| [template](https://github.com/gofiber/template) | Este pacote contém 8 mecanismos de template que podem ser usados com Fiber `v1.10.x`. É necessário Go versão 1.13 ou superior. |
+| [websocket](https://github.com/gofiber/websocket) | Baseado no WebSocket do Fasthttp para Fiber com suporte a Locals |
+
+## 🕶️ Lista Incrível
+
+Para mais artigos, middlewares, exemplos ou ferramentas, confira nossa [lista incrível](https://github.com/gofiber/awesome-fiber).
+
+## 👍 Contribuindo
+
+Se você quer **agradecer** e/ou apoiar o desenvolvimento ativo do `Fiber`:
+
+1. Deixe uma [estrela no GitHub](https://github.com/gofiber/fiber/stargazers) do projeto.
+2. Tweet sobre o projeto [no seu 𝕏 (Twitter)](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Escreva um review ou tutorial no [Medium](https://medium.com/), [Dev.to](https://dev.to/) ou blog pessoal.
+4. Apoie o projeto pagando uma [xícara de café](https://buymeacoff.ee/fenny).
+
+## ☕ Apoiadores
+
+Fiber é um projeto open source que usa de doações para pagar seus custos (domínio, GitBook, Netlify e hospedagem serverless). Se você quiser apoiar o projeto, você pode ☕ [**pagar um café**](https://buymeacoff.ee/fenny).
+
+| | User | Donation |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------- |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Contribuidores de código
+
+
+
+## ⭐️ Stargazers
+
+
+
+## ⚠️ Licença
+
+Todos os direitos reservados (c) 2019-presente [Fenny](https://github.com/fenny) e [Contribuidores](https://github.com/gofiber/fiber/graphs/contributors).
+`Fiber` é software livre e aberto sob a [licença MIT](https://github.com/gofiber/fiber/blob/master/LICENSE).
+O logo oficial foi criado por [Vic Shóstak](https://github.com/koddr) e distribuído sob a licença [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) (CC BY-SA 4.0 International).
+
+**Licença das bibliotecas de terceiros**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_ru.md b/.github/README_ru.md
new file mode 100644
index 0000000..bfb4166
--- /dev/null
+++ b/.github/README_ru.md
@@ -0,0 +1,696 @@
+
+ Fiber — это веб фреймворк, который был вдохновлен Express и основан на Fasthttp, самом быстром HTTP-движке написанном на Go. Фреймворк был разработан с целью упростить процесс быстрой разработки высокопроизводительных веб-приложений с нулевым распределением памяти.
+
+
+## ⚡️ Быстрый старт
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Бенчмарки
+
+Тестирование проводилось с помощью [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) и [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Если вы хотите увидеть все результаты, пожалуйста, посетите наш [Wiki](https://docs.gofiber.io/extra/benchmarks).
+
+
+
+
+
+
+## ⚙️ Установка
+
+Убедитесь, что 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):
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Особенности
+
+- Надежная [маршрутизация](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/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)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- Документация доступна на [19 языках](https://docs.gofiber.io/)
+- И многое другое, [посетите наш Wiki](https://docs.gofiber.io/)
+
+## 💡 Философия
+
+Новые Go-программисты, которые переключаются с [Node.js](https://nodejs.org/en/about/) на [Go](https://go.dev/doc/), имеют дело с очень извилистой кривой обучения, прежде чем они смогут начать создавать свои веб-приложения или микросервисы. Fiber, как **веб-фреймворк**, был создан с идеей **минимализма** и следовал **принципу UNIX**, так что новички смогут быстро войти в мир Go без особых проблем.
+
+Fiber **вдохновлен** Express, самым популярным веб фреймворком в Интернете. Мы объединили **простоту** Express и **чистую производительность** Go. Если вы когда-либо реализовывали веб-приложение на Node.js (_с использованием Express или аналогичного фреймворка_), то многие методы и принципы покажутся вам **очень знакомыми**.
+
+Мы **прислушиваемся** к нашим пользователям в [issues](https://github.com/gofiber/fiber/issues), Discord [канале](https://gofiber.io/discord) _и в остальном Интернете_, чтобы создать **быстрый**, **гибкий** и **дружелюбный** веб фреймворк на Go для **любых** задач, **дедлайнов** и **уровней** разработчиков! Как это делает Express в мире JavaScript.
+
+## ⚠️ Ограничения
+
+- Из-за того, что Fiber использует пакет unsafe, библиотека не всегда может быть совместима с последней версией Go. Fiber 2.40.0 был протестирован с версиями Go от 1.17 до 1.21.
+- Fiber не совместим с интерфейсами net/http. Это означает, что вы не сможете использовать такие проекты, как gqlgen, go-swagger или любые другие, которые являются частью экосистемы net/http.
+
+## 👀 Примеры
+
+Ниже перечислены некоторые из распространенных примеров. Если вы хотите увидеть больше примеров кода, пожалуйста, посетите наш [репозиторий рецептов](https://github.com/gofiber/recipes) или [документацию по API](https://docs.gofiber.io).
+
+#### 📖 [**Basic Routing**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Serving Static Files**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware & Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/register
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 Показать больше примеров кода
+
+### Views engines
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Engines](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Если не указано ни одного движка для views, Fiber использует [html/template](https://pkg.go.dev/html/template/).
+
+Вы можете использовать движки [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) или [pug](https://github.com/Joker/jade) и другие...
+
+Ознакомьтесь с пакетом [Template](https://github.com/gofiber/template), который поддерживает множество движков для views.
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+### Группировка путей в цепочки
+
+📖 [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
+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"))
+}
+
+```
+
+Проверем CORS, присвоив домен в заголовок `Origin`, отличный от `localhost`:
+
+```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!")
+ })
+
+ // Last middleware to match anything
+ 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 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"))
+}
+```
+
+### Recover middleware
+
+📖 [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"))
+}
+
+```
+
+
+
+## 🧬 Внутренние Middleware
+
+Вот список middleware, входящих в состав фреймворка Fiber.
+
+| Middleware | Описание |
+| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercept and cache responses |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Expose environment variables with providing an optional config. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Allows you to proxy requests to a multiple servers |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [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 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
+
+Список модулей middleware, размещенных на внешнем хостинге от [Fiber team](https://github.com/orgs/gofiber/people).
+
+| Middleware | Описание |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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! |
+
+## 🕶️ Полезный список
+
+Дополнительные статьи, middleware, примеры или инструменты смотри в нашем [полезном списке](https://github.com/gofiber/awesome-fiber).
+
+## 👍 Помощь проекту
+
+Если вы хотите сказать **спасибо** и/или поддержать активное развитие `Fiber`:
+
+1. Добавьте [GitHub Star](https://github.com/gofiber/fiber/stargazers) в проект.
+2. Напишите о проекте [в вашем 𝕏 (Twitter)](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Сделайте обзор фреймворка на [Medium](https://medium.com/), [Dev.to](https://dev.to/) или в личном блоге.
+4. Поддержите проект, купив [чашку кофе](https://buymeacoff.ee/fenny).
+
+## ☕ Поддержка проекта
+
+Fiber — это проект с открытым исходным кодом, который работает на пожертвования для оплаты счетов, например, нашего доменного имени, GitBook, Netlify и serverless-хостинга.
+
+Если вы хотите поддержать, то ☕ [**купите чашку кофе**](https://buymeacoff.ee/fenny).
+
+| | Пользователи | Пожертвования |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------------ |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Контрибьютеры
+
+
+
+## ⭐️ Stargazers
+
+
+
+## ⚠️ Лицензия
+
+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**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_sa.md b/.github/README_sa.md
new file mode 100644
index 0000000..a5a54e9
--- /dev/null
+++ b/.github/README_sa.md
@@ -0,0 +1,758 @@
+
+ Fiber هو إطار ويب مستوحى من Express مبني على Fasthttp, اسرع محرك HTTP لـ Go. مصمم ليكون سهل لأغراض السرعة مع عدم تخصيص ذاكرة والأداء و الاداء العالي دائما.
+
+
+## 🤖 مقايس الاداء
+
+يتم تنفيذ هذه الاختبارات من قبل [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) و [Go Web](https://github.com/smallnest/go-web-framework-benchmark). إذا كنت تريد رؤية جميع النتائج ، يرجى زيارة موقعنا [Wiki](https://docs.gofiber.io/extra/benchmarks).
+
+
+
+
+
+
+## ⚙️ تثبيت
+
+تأكد من تثبيت 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) أمر:
+
+
+
+
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+
+
+## 🎯 الميزات
+
+- قوي [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/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)
+- [Server-Sent events](https://github.com/gofiber/recipes/tree/master/sse)
+- [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- ترجم الى [19 لغة أخرى](https://docs.gofiber.io/)
+- وأكثر بكثير, [استكشف Fiber](https://docs.gofiber.io/)
+
+## 💡 فلسفة
+
+قوفر(مستخدمي لغة Go الجدد) جديد يجعل التبديل من [Node.js](https://nodejs.org/en/about/) الى [Go](https://go.dev/doc/)تتعامل مع منحنى التعلم قبل أن يتمكنوا من البدء في بناءتطبيقات الويب . Fiber, كـ **إطار الويب**, تم إنشاؤه بفكرة **minimalism** ويتبع **UNIX way**, حتى يتمكن القوفرون الجدد من دخول عالم Go بترحيب حار وموثوق.
+
+Fiber هو **مستوحى** من Express, إطار الويب الأكثر شعبية على الإنترنت. قمنا بدمج **سهولة** الـ Express و **الأداء الخام** لـ Go. إذا كنت قد قمت بتطبيق تطبيق ويب في Node.js (_using Express or similar_), ستظهر العديد من الأساليب والمبادئ **الاكثر شيوعاً** لك.
+
+نحن **نصغي** لمستخدمينا [issues](https://github.com/gofiber/fiber/issues), نناقش [channel](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.17 to 1.21.
+- 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.
+
+## 👀 أمثلة
+
+فيما يلي بعض الأمثلة الشائعة. إذا كنت ترغب في رؤية المزيد من أمثلة التعليمات البرمجية, يرجى زيارة [Recipes repository](https://github.com/gofiber/recipes) او زيارة [API documentation](https://docs.gofiber.io).
+
+#### 📖 [**Basic Routing**](https://docs.gofiber.io/#basic-routing)
+
+
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/register
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+
+
+ 📚 إظهار المزيد من أمثلة التعليمات البرمجية
+
+### Views engines
+
+📖 [Config](https://docs.gofiber.io/api/fiber#config)
+📖 [Engines](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Fiber defaults to the [html/template](https://pkg.go.dev/html/template/) when no view engine is set.
+
+If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
+
+Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
+
+
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+
+## 🧬 Internal Middleware
+
+Here is a list of middleware that are included within the Fiber framework.
+
+| Middleware | Description |
+| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercept and cache responses |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Expose environment variables with providing an optional config. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Allows you to proxy requests to a multiple servers |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [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 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
+
+List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
+
+| Middleware | Description |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
+| [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).
+
+## 👍 مساهمة
+
+إذا كنت تريد أن تقول **شكرا جزيل** و/او دعم التنمية النشطة للـ `Fiber`:
+
+1. اضف [GitHub نجمة](https://github.com/gofiber/fiber/stargazers) للمشروع.
+2. غرد عن المشروع [في تويتر ](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. اكتب مراجعة أو برنامج تعليمي عن [Medium](https://medium.com/), [Dev.to](https://dev.to/) او في موقعك الشخصي.
+4. دعم المشروع بالتبرع بـ [كوب من القهوة](https://buymeacoff.ee/fenny).
+
+## ☕ الداعمين
+
+Fiber هو مشروع مفتوح المصدر يعمل على التبرعات لدفع الفواتير ، على سبيل المثال اسم النطاق الخاص بنا , gitbook, netlify and serverless الاستضافة. إذا كنت تريد دعم Fiber, تستطيع ☕ [**شراء كوب قهوة هنا**](https://buymeacoff.ee/fenny).
+
+| | المستخدم | التبرع |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------ |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 المساهمون في كتابة الكود
+
+
+
+## ⭐️ Stargazers
+
+
+
+## ⚠️ رخصة
+
+Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](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**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_tr.md b/.github/README_tr.md
new file mode 100644
index 0000000..3ab0f15
--- /dev/null
+++ b/.github/README_tr.md
@@ -0,0 +1,686 @@
+
+ Fiber, Go için en hızlı HTTP sunucusu olan Fasthttp üzerine inşa edilmiş ve Express'ten ilham almış bir web framework'üdür. Sıfır bellek ataması ve performans göz önünde bulundurularak hızlı geliştirme ve kolay geliştirme için tasarlanmıştır.
+
+
+## ⚡️ Hızlı Başlangıç
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Performans Ölçümleri
+
+Bu testler [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext) ve [Go Web](https://github.com/smallnest/go-web-framework-benchmark) tarafından gerçekleştirildi. Bütün sonuçları görmek için lütfen [Wiki](https://docs.gofiber.io/extra/benchmarks) sayfasını ziyaret ediniz.
+
+
+
+
+
+
+## ⚙️ Kurulum
+
+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:
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Özellikler
+
+- 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ı
+- [API uç noktaları](https://docs.gofiber.io/api/ctx)
+- Middleware'lar & [Next](https://docs.gofiber.io/api/ctx#next) desteği
+- [Hızlı](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) sunucu taraflı programlama
+- [Template motorları](https://github.com/gofiber/template)
+- [WebSocket desteği](https://github.com/gofiber/websocket)
+- [Server-Sent eventler](https://github.com/gofiber/recipes/tree/master/sse)
+- [Rate Limiter](https://docs.gofiber.io/api/middleware/limiter)
+- [19 dilde](https://docs.gofiber.io/) mevcut
+- Ve daha fazlası, [Fiber'ı keşfet](https://docs.gofiber.io/)
+
+## 💡 Felsefe
+
+[Node.js](https://nodejs.org/en/about/)'ten [Go](https://go.dev/doc/)'ya geçen yeni gopherlar kendi web uygulamalarını ve mikroservislerini yazmaya başlamadan önce dili öğrenmek ile uğraşıyorlar. Fiber, bir **framework** olarak, **minimalizm** ve **UNIX yolu**nu izleme fikri ile oluşturuldu. Böylece yeni gopherlar sıcak ve güvenilir bir hoş geldin ile Go dünyasına giriş yapabilirler.
+
+Fiber, internet üzerinde en popüler web framework'ü olan Express'ten **esinlenmiştir**. Biz Express'in **kolaylığını** ve Go'nun **ham performansını** birleştirdik. Daha önce Node.js üzerinde (Express veya benzerini kullanarak) bir web uygulaması geliştirdiyseniz, pek çok metod ve prensip size **oldukça tanıdık** gelecektir.
+
+## ⚠️ 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.17 ile 1.21 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
+
+Aşağıda yaygın örneklerden bazıları listelenmiştir. Daha fazla kod örneği görmek için lütfen [Github reposunu](https://github.com/gofiber/recipes) veya [API dokümantasyonunu](https://docs.gofiber.io) ziyaret ediniz.
+
+#### 📖 [**Basit Rotalama**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/kayit
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ kayit
+ })
+
+ // GET /flights/IST-ESB
+ app.Get("/flights/:kalkis-:inis", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 Kalkış: %s, İniş: %s", c.Params("kalkis"), c.Params("inis"))
+ return c.SendString(msg) // => 💸 Kalkış: IST, İniş: ESB
+ })
+
+ // GET /sozluk.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 sozluk.txt
+ })
+
+ // GET /muhittin/75
+ app.Get("/:isim/:yas/:cinsiyet?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s %s yaşında", c.Params("isim"), c.Params("yas"))
+ return c.SendString(msg) // => 👴 muhittin 75 yaşında
+ })
+
+ // GET /muhittin
+ app.Get("/:isim", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Merhaba, %s 👋!", c.Params("isim"))
+ return c.SendString(msg) // => Merhaba Muhittin 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Route İsimlendirmesi**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ kayit
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Cikti:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Statik Dosya Sunumu**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**Middleware & Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Bütün routelara etki eder.
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 İlk handler")
+ return c.Next()
+ })
+
+ // /api ile başlayan bütün routelara etki eder.
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 İkinci handler")
+ return c.Next()
+ })
+
+ // GET /api/register
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Son handler")
+ return c.SendString("Merhaba, Dünya 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 Daha fazla kod örneği göster
+
+### View Motorları
+
+📖 [Yapılandırma](https://docs.gofiber.io/api/fiber#config)
+📖 [Motorlar](https://github.com/gofiber/template)
+📖 [Render](https://docs.gofiber.io/api/ctx#render)
+
+Hiçbir View Motoru ayarlanmadığında Fiber varsayılan olarak [html/template'a](https://pkg.go.dev/html/template/) geçer.
+
+Kısmi yürütmek istiyorsanız veya [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) veya [pug](https://github.com/Joker/jade) gibi farklı motorlar kullanmak istiyorsanız
+
+Çoklu View Engine destekleyen [Template'ımıza](https://github.com/gofiber/template göz atın.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // Uygulamayı başlatmadan önce View Engine tanımlayabilirsiniz:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // Ve şimdi `./views/home.pug` templateni şu şekilde çağırabilirsiniz:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Routeları Zincirler Halinde Gruplama
+
+📖 [Group](https://docs.gofiber.io/api/app#group)
+
+```go
+func middleware(c *fiber.Ctx) error {
+ fmt.Println("Beni umursama!")
+ 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 routeları
+ v1 := api.Group("/v1", middleware) // /api/v1
+ v1.Get("/list", handler) // /api/v1/list
+ v1.Get("/user", handler) // /api/v1/user
+
+ // API v2 routeları
+ v2 := api.Group("/v2", middleware) // /api/v2
+ v2.Get("/list", handler) // /api/v2/list
+ v2.Get("/user", handler) // /api/v2/user
+
+ // ...
+}
+```
+
+### Middleware Loglama (Logger)
+
+📖 [Logger](https://docs.gofiber.io/api/middleware/logger)
+
+```go
+package main
+
+import (
+ "fmt"
+
+ "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"))
+}
+```
+
+### Farklı Originler Arası Kaynak Paylaşımı (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ığı içinde herhangi bir alan adı kullanarak CORS'u kontrol edin:
+
+```bash
+curl -H "Origin: http://example.com" --verbose http://localhost:3000
+```
+
+### Özelleştirilebilir 404 yanıtları
+
+📖 [HTTP Methodları](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("Bu bir demodur!")
+ })
+
+ app.Post("/register", func(c *fiber.Ctx) error {
+ return c.SendString("Hoşgeldiniz!")
+ })
+
+ // Hiçbir endpointle eşleşmezse gideceği middleware ve yanıtı.
+ app.Use(func(c *fiber.Ctx) error {
+ return c.SendStatus(404)
+ // => 404 "Sayfa bulunamadı"
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### JSON Yanıtları
+
+📖 [JSON](https://docs.gofiber.io/api/ctx#json)
+
+```go
+type User struct {
+ Isim string `json:"name"`
+ Yas int `json:"age"`
+}
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/user", func(c *fiber.Ctx) error {
+ return c.JSON(&User{"Muhittin Topalak", 20})
+ // => {"Isim":"Muhittin Topalak", "Yas":20}
+ })
+
+ app.Get("/json", func(c *fiber.Ctx) error {
+ return c.JSON(fiber.Map{
+ "success": true,
+ "mesaj": "Merhaba Muhittin Topalak!",
+ })
+ // => {"success":true, "message":"Merhaba Muhittin Topalak!"}
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### WebSocket Desteği
+
+📖 [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 Eventler
+
+📖 [Daha Fazla Bilgi](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 Kurtarıcısı
+
+📖 [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("normalde bu uygulamanızı çökertir.")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+## 🧬 Dahili Middlewarelar
+
+Fiber'a dahil edilen middlewareların bir listesi aşağıda verilmiştir.
+
+| Middleware | Açıklama |
+| :------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware'ı, bir HTTP Basic auth sağlar. Geçerli kimlik bilgileri için sonraki handlerı ve eksik veya geçersiz kimlik bilgileri için 401 döndürür. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Reponseları durdur ve önbelleğe al. |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Fiber için sıkıştırma middleware, varsayılan olarak `deflate`, `gzip` ve `brotli`yi destekler. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Çeşitli seçeneklerle başlangıçlar arası kaynak paylaşımını \(CORS\) etkinleştirin. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | CSRF exploitlerinden korunun. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware'ı cookie değerlerini şifreler. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Environment değişkenlerini belirtilen ayarlara göre dışarıya açar. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware'ı sayfa içeriği değişmediyse bant genişliğini daha verimli kullanmak için tam sayfa içeriğini tekrar göndermez. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware, HTTP serverinin bazı runtime değişkenlerini JSON formatında sunar. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Bir dosya yolu sağlanmışsa, loglardaki favicon'u yoksayar veya bellekten sunar. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | Fiber için FileSystem middleware, Alireza Salary'e özel teşekkürler. |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Fiber için hız sınırlayıcı middleware'i. Açık API'lere ve/veya parola sıfırlama gibi endpointlere yönelik tekrarlanan istekleri sınırlamak için kullanın. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP istek/yanıt logger'ı. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware'ı sunucu metriklerini rapor eder, express-status-monitor'den esinlenildi. |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Matthew Lee'ye özel teşekkürler \(@mthli\). |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Birden çok sunucuya proxy istekleri yapmanızı sağlar. |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware'i, stack chain'ini herhangi bir yerindeki paniklerden kurtulur ve kontrolü merkezileştirilmiş [ErrorHandler'e](https://docs.gofiber.io/guide/error-handling) verir. |
+| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | Her requeste id verir. |
+| [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
+
+Harici olarak barındırılan middlewareların modüllerinin listesi. Bu middlewarelar, [Fiber ekibi](https://github.com/orgs/gofiber/people) tarafından geliştirilir.
+
+| Middleware | Açıklama |
+| :------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT, bir JSON Web Token \(JWT\) yetkilendirmesi döndüren middleware. |
+| [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.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
+
+Daha fazla yazı, middleware, örnek veya araç için [awesome list](https://github.com/gofiber/awesome-fiber) reposunu kontrol etmeyi unutmayın.
+
+## 👍 Destek
+
+Eğer **teşekkür etmek** veya `Fiber`'ın aktif geliştirilmesini desteklemek istiyorsanız:
+
+1. Projeye [yıldız](https://github.com/gofiber/fiber/stargazers) verebilirsiniz.
+2. [𝕏 (Twitter) hesabınızdan](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber) proje hakkında tweet atabilirsiniz.
+3. [Medium](https://medium.com/), [Dev.to](https://dev.to/) veya kişisel blogunuz üzerinden bir inceleme veya eğitici yazı yazabilirsiniz.
+4. Projeye [bir fincan kahve](https://buymeacoff.ee/fenny) bağışlayarak destek olabilirsiniz.
+
+## ☕ Destekçiler
+
+Fiber; alan adı, gitbook, netlify, serverless yer sağlayıcısı giderleri ve benzeri şeyleri ödemek için bağışlarla yaşayan bir açık kaynaklı projedir. Eğer Fiber'a destek olmak isterseniz, ☕ [**buradan kahve ısmarlayabilirsiniz**](https://buymeacoff.ee/fenny).
+
+| | User | Donation |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------- |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Koda Katkı Sağlayanlar
+
+
+
+## ⭐️ Projeyi Yıldızlayanlar
+
+
+
+## ⚠️ Lisans
+
+Telif (c) 2019-günümüz [Fenny](https://github.com/fenny) ve [katkıda bulunanlar](https://github.com/gofiber/fiber/graphs/contributors). `Fiber`, [MIT Lisansı](https://github.com/gofiber/fiber/blob/master/LICENSE) altında özgür ve açık kaynaklı bir yazılımdır. Resmî logosu [Vic Shóstak](https://github.com/koddr) tarafından tasarlanmıştır ve [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) lisansı altında dağıtımı yapılıyor. (CC BY-SA 4.0 International).
+
+**Üçüncü Parti Kütüphane Lisansları**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_uk.md b/.github/README_uk.md
new file mode 100644
index 0000000..ef9f365
--- /dev/null
+++ b/.github/README_uk.md
@@ -0,0 +1,721 @@
+
+ Fiber — це веб фреймворк, який був натхненний Express
+ і заснований на Fasthttp, найшвидшому HTTP-двигунові написаному на
+ Go. Фреймворк розроблено з метою спростити процес швидкої розробки
+ високопродуктивних веб-додатків з нульовим розподілом пам'яті.
+
+
+## ⚡️ Швидкий старт
+
+```go
+package main
+
+import "github.com/gofiber/fiber/v2"
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World 👋!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+## 🤖 Еталонні показники
+
+Тестування проводилося за допомогою [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext)
+та [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Якщо ви хочете побачити всі результати, будь ласка
+відвідайте наш [Wiki](https://docs.gofiber.io/extra/benchmarks).
+
+
+
+
+
+
+## ⚙️ Встановлення
+
+Переконайтеся, що 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):
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 Особливості
+
+- Надійна [маршрутизація](https://docs.gofiber.io/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)
+- [Швидке](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)
+- [Обмежувач швидкості](https://docs.gofiber.io/api/middleware/limiter)
+- Документація доступна [19 мовами](https://docs.gofiber.io/)
+- І багато іншого, [відвідайте наш Wiki](https://docs.gofiber.io/)
+
+## 💡 Філософія
+
+Нові програмісти, які переходять із [Node.js](https://nodejs.org/en/about/) на [Go](https://go.dev/doc/), мають справу зі звивистою кривою навчання, перш ніж можуть розпочати створення своїх веб-додатків або мікросервісів. Fiber, як **веб-фреймворк**, було створено з ідеєю **мінімалізму** та слідує **шляху UNIX**, щоб нові програмісти могли швидко увійти у світ Go з теплим та надійним прийомом.
+
+Fiber **натхненний** Express, найпопулярнішим веб-фреймворком в Інтернеті. Ми поєднали **легкість** Express і **чисту продуктивність** Go. Якщо ви коли-небудь реалізовували веб-додаток у Node.js (_з використанням Express або подібного_), то багато методів і принципів здадуться вам **дуже звичайними**.
+
+Ми **прислухаємося** до наших користувачів у [issues](https://github.com/gofiber/fiber/issues), Discord [сервері](https://gofiber.io/discord) та в інших місцях Інтернета, щоб створити **швидкий**, **гнучкий** та **доброзичливий** веб фреймворк на Go для **будь-яких** завдань, **дедлайнів** та **рівнів** розробників! Як це робить Express у світі JavaScript.
+
+## ⚠️ Обмеження
+
+- Через те, що Fiber використовує unsafe, бібліотека не завжди може бути сумісною з останньою версією Go. Fiber 2.40.0 було протестовано з Go версій 1.17 до 1.21.
+- Fiber не сумісний з інтерфейсами net/http. Це означає, що ви не зможете використовувати такі проекти, як gqlgen, go-swagger або будь-які інші, які є частиною екосистеми net/http.
+
+## 👀 Приклади
+
+Нижче наведено деякі типові приклади. Якщо ви хочете переглянути більше прикладів коду, відвідайте наше [репозиторій рецептів](https://github.com/gofiber/recipes) або відвідайте нашу розміщену [документацію API](https://docs.gofiber.io).
+
+#### 📖 [**Основна маршрутизація**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 From: LAX, To: SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john is 75 years old
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name"))
+ return c.SendString(msg) // => Hello john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+#### 📖 [**Назви маршруту**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // Prints:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+#### 📖 [**Обслуговування статичних файлів**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+#### 📖 [**Middleware & Next**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // Match any route
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 First handler")
+ return c.Next()
+ })
+
+ // Match all routes starting with /api
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 Second handler")
+ return c.Next()
+ })
+
+ // GET /api/list
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 Last handler")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+ 📚 Показати більше прикладів коду
+
+### Двигуни перегляду
+
+📖 [Конфігурація](https://docs.gofiber.io/api/fiber#config)
+📖 [Двигуни](https://github.com/gofiber/template)
+📖 [Рендер](https://docs.gofiber.io/api/ctx#render)
+
+Fiber за умовчанням використовує [html/template](https://pkg.go.dev/html/template/), якщо жодного двигуна не було вказано.
+
+Якщо ви хочете виконати частково або використовувати інший двигун, наприклад [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) або [jade](https://github.com/Joker/jade), тощо.
+
+Перегляньте наш пакет [Шаблон](https://github.com/gofiber/template), який підтримує кілька двигунів перегляду.
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // You can setup Views engine before initiation app:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // And now, you can call template `./views/home.pug` like this:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Групування маршрутів у ланцюги
+
+📖 [Група](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 логування
+
+📖 [Логування](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"))
+}
+```
+
+### Спільне використання ресурсів між джерелами (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"))
+}
+```
+
+Перевірте CORS, передавши будь-який домен у заголовку `Origin`:
+
+```bash
+curl -H "Origin: http://example.com" --verbose http://localhost:3000
+```
+
+### Власна відповідь 404
+
+📖 [HTTP Методи](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!")
+ })
+
+ // Last middleware to match anything
+ app.Use(func(c *fiber.Ctx) error {
+ return c.SendStatus(404)
+ // => 404 "Not Found"
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### JSON Відповідь
+
+📖 [JSON](https://docs.gofiber.io/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 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
+
+📖 [Більше інформації](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"))
+}
+```
+
+### Recover middleware
+
+📖 [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"))
+}
+```
+
+
+
+### Використання довіреного проксі
+
+📖 [Конфігурація](https://docs.gofiber.io/api/fiber#config)
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/recover"
+)
+
+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,
+ })
+
+ // ...
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+## 🧬 Внутрішні Middleware
+
+Ось список middleware, яке входить до складу Fiber фреймворку.
+
+| Middleware | Опис |
+| :------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Middleware який забезпечує базову автентифікацію по HTTP. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Middleware який перехоплює та кешує відповіді |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | стиснення для Fiber, воно за замовчуванням підтримує `deflate`, `gzip` і `brotli`. |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Middleware який вмикає перехресне використання ресурсів \(CORS\) із різними параметрами. |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Захист від експлойтів CSRF. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Шифрування значень файлів cookie. |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | Middleware для відкриття змінних середевищ. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | Middleware яке робить кеш-пам’ять більш ефективним і заощаджує пропускну здатність, оскільки веб-серверу не потрібно повторно надсилати повну відповідь, якщо вміст не змінився. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Middleware який обслуговує доступні варіанти середовища виконання HTTP у форматі JSON. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ігнорування значка із журналів або обслуговувати з пам’яті, якщо вказано шлях до файлу. |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | Middleware файлової системи, особлива подяка та кредити Alireza Salary. |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Ообмеження швидкості для Fiber. Використовуйте для обмеження повторних запитів до загальнодоступних API та/або кінцевих точок, таких як скидання пароля. |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | Реєстратор запитів/відповідей HTTP. |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Middleware який повідомляє показники сервера. |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Особлива подяка Метью Лі \(@mthli\) . |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Дозволяє надсилати проксі-запити до кількох серверів. |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Middleware який відновлює паніки будь-де в ланцюжку стека та передає керування централізованому [обробнику помилок](https://docs.gofiber.io/guide/error-handling). |
+| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | До кожного запиту додає ідентифікатор запиту. |
+| [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
+
+Список зовнішніх middleware модулів, які підтримуються [командою Fiber](https://github.com/orgs/gofiber/people).
+
+| Middleware | Опис |
+| :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT повертає middleware автентифікації JSON Web Token \(JWT\). |
+| [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 з підтримкою місцевих користувачів! |
+
+## 🕶️ Чудовий список
+
+Більше статей, middleware, прикладів або інструментів дивіться у нашому [чудовому списку](https://github.com/gofiber/awesome-fiber).
+
+## 👍 Внести свій внесок
+
+Якщо ви хочете сказати **дякую** та/або підтримати активний розвиток `Fiber`:
+
+1. Додайте [зірку GitHub](https://github.com/gofiber/fiber/stargazers) до проекту.
+2. Напишіть про проект [у своєму 𝕏 (Twitter)](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
+3. Напишіть огляд або підручник на [Medium](https://medium.com/), [Dev.to](https://dev.to/) або особистому блогу.
+4. Підтримайте проект, пожертвувавши [чашку кави](https://buymeacoff.ee/fenny).
+
+## ☕ Прихильники
+
+Fiber – це проект із відкритим вихідним кодом, який працює за рахунок пожертвувань для оплати рахунків, наприклад наше доменне ім’я, gitbook, netlify і безсерверний хостинг. Якщо ви хочете підтримати Fiber, ви можете ☕ [**купити каву тут**](https://buymeacoff.ee/fenny).
+
+| | Користувач | Пожертвування |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------------ |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/marvinjwendt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 Автори коду
+
+
+
+## ⭐️ Звіздарі
+
+
+
+## ⚠️ Ліцензія
+
+Авторське право (c) 2019-дотепер [Fenny](https://github.com/fenny) та [Contributors](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).
+
+**Ліцензії сторонніх бібліотек**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/README_zh-CN.md b/.github/README_zh-CN.md
new file mode 100644
index 0000000..4314e05
--- /dev/null
+++ b/.github/README_zh-CN.md
@@ -0,0 +1,695 @@
+
+
+## ⚙️ 安裝
+
+先確定您已經安裝 `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:
+
+```bash
+go get -u github.com/gofiber/fiber/v2
+```
+
+## 🎯 特色
+
+- 強固的[路由系統](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/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)
+- 支援[速率限制](https://docs.gofiber.io/api/middleware/limiter)
+- 有 [19 門語言](https://docs.gofiber.io/)的翻譯
+- 還有很多功能,[開始探索 Fiber](https://docs.gofiber.io/)
+
+## 💡 設計哲學
+
+從 [Node.js](https://nodejs.org/en/about/) 轉到 [Go](https://go.dev/doc/) 的新進 Go 開發者,得先面對 Go 的各種知識點,才能開始建構自己的 Web 應用程式或微服務。Fiber 作為一款 **Web 框架**,設計之初便以 **極簡主義** 為理念,並遵循 **UNIX 之道**,讓新進 Go 開發者能夠快速隨著友善且值得信賴的社群,進入 Go 的世界。
+
+Fiber **啟發自** Express——網際網路上最知名的 Web 框架,我們將 Express 的 **易用性** 和 Go 的 **原始效能** 結合在一起。如果您曾經在 Node.js(使用 Express 或類似框架)實作過 Web 應用程式,那麼許多方法和開發準則,將讓您感到 **無比熟悉**。
+
+我們 **傾聽** 使用者在 [Issues](https://github.com/gofiber/fiber/issues)、Discord [群組](https://gofiber.io/discord) 和 **網路上任何角落** 的意見和建議,製作出 **快速**、**靈活** 且 **易於上手** 的 Go Web 框架,來應對**任何**工作、**繳件期限**以及開發者的**能力區間**——如同 Express 在 JavaScript 世界所扮演的角色一樣!
+
+## ⚠️ 限制
+
+- 由於 Fiber 有用到 Unsafe,本函式庫有時可能無法相容最新版的 Go 語言。Fiber 2.40.0 已在 Go 1.17 至 1.21 的版本測試過。
+- Fiber 不相容 net/http 的介面,意味著您無法使用像是 gqlgen、go-swagger 或其他任何屬於 net/http 生態系統的專案。
+
+## 👀 範例
+
+下方列出一些常見範例。如果您想查看更多程式碼範例,請參閱我們的 [Recipes 儲存庫](https://github.com/gofiber/recipes),或前往我們提供的 [API 文件](https://docs.gofiber.io)。
+
+#### 📖 [**基礎路由**](https://docs.gofiber.io/#basic-routing)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ })
+
+ // GET /flights/LAX-SFO
+ app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("💸 從:%s,到:%s", c.Params("from"), c.Params("to"))
+ return c.SendString(msg) // => 💸 從:LAX,到:SFO
+ })
+
+ // GET /dictionary.txt
+ app.Get("/:file.:ext", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext"))
+ return c.SendString(msg) // => 📃 dictionary.txt
+ })
+
+ // GET /john/75
+ app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("👴 %s 已經 %s 歲了", c.Params("name"), c.Params("age"))
+ return c.SendString(msg) // => 👴 john 已經 75 歲了
+ })
+
+ // GET /john
+ app.Get("/:name", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("哈囉,%s 👋!", c.Params("name"))
+ return c.SendString(msg) // => 哈囉,john 👋!
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**路由命名**](https://docs.gofiber.io/api/app#name)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // GET /api/register
+ app.Get("/api/*", func(c *fiber.Ctx) error {
+ msg := fmt.Sprintf("✋ %s", c.Params("*"))
+ return c.SendString(msg) // => ✋ register
+ }).Name("api")
+
+ data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
+ fmt.Print(string(data))
+ // 會輸出:
+ // {
+ // "method": "GET",
+ // "name": "api",
+ // "path": "/api/*",
+ // "params": [
+ // "*1"
+ // ]
+ // }
+
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**寄存靜態檔案**](https://docs.gofiber.io/api/app#static)
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Static("/", "./public")
+ // => http://localhost:3000/js/script.js
+ // => http://localhost:3000/css/style.css
+
+ app.Static("/prefix", "./public")
+ // => http://localhost:3000/prefix/js/script.js
+ // => http://localhost:3000/prefix/css/style.css
+
+ app.Static("*", "./public/index.html")
+ // => http://localhost:3000/any/path/shows/index/html
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+#### 📖 [**中介模組和接續函式 (Next)**](https://docs.gofiber.io/api/ctx#next)
+
+```go
+func main() {
+ app := fiber.New()
+
+ // 符合任何路由
+ app.Use(func(c *fiber.Ctx) error {
+ fmt.Println("🥇 第一個處理常式")
+ return c.Next()
+ })
+
+ // 符合所有 /api 開頭的路由
+ app.Use("/api", func(c *fiber.Ctx) error {
+ fmt.Println("🥈 第二個處理常式")
+ return c.Next()
+ })
+
+ // GET /api/list
+ app.Get("/api/list", func(c *fiber.Ctx) error {
+ fmt.Println("🥉 最後一個處理常式")
+ return c.SendString("Hello, World 👋!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+```
+
+
+ 📚 展示更多程式碼範例
+
+### 檢視引擎
+
+📖 [組態設定](https://docs.gofiber.io/api/fiber#config)
+📖 [引擎](https://github.com/gofiber/template)
+📖 [轉譯 (render)](https://docs.gofiber.io/api/ctx#render)
+
+若未指定檢視引擎,Fiber 預設採用 [html/template](https://pkg.go.dev/html/template/)。
+
+如果您想執行部分檢視 (partials),或者是使用如 [amber](https://github.com/eknkc/amber)、[handlebars](https://github.com/aymerick/raymond)、[mustache](https://github.com/cbroglie/mustache) 或 [pug](https://github.com/Joker/jade) 等等不同的引擎……
+
+請參考我們的 [Template](https://github.com/gofiber/template) 套件——它支援多種檢視引擎。
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/template/pug"
+)
+
+func main() {
+ // 您可以在 app 初始化前設定檢視 (Views) 引擎:
+ app := fiber.New(fiber.Config{
+ Views: pug.New("./views", ".pug"),
+ })
+
+ // 現在,您可以用下面這種方式呼叫 `./views/home.pug` 樣板:
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("home", fiber.Map{
+ "title": "Homepage",
+ "year": 1999,
+ })
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### 組合路由鏈
+
+📖 [分組](https://docs.gofiber.io/api/app#group)
+
+```go
+func middleware(c *fiber.Ctx) error {
+ fmt.Println("不要理我!")
+ return c.Next()
+}
+
+func handler(c *fiber.Ctx) error {
+ return c.SendString(c.Path())
+}
+
+func main() {
+ app := fiber.New()
+
+ // 根 API 路由
+ api := app.Group("/api", middleware) // /api
+
+ // API v1 路由
+ v1 := api.Group("/v1", middleware) // /api/v1
+ v1.Get("/list", handler) // /api/v1/list
+ v1.Get("/user", handler) // /api/v1/user
+
+ // API v2 路由
+ v2 := api.Group("/v2", middleware) // /api/v2
+ v2.Get("/list", handler) // /api/v2/list
+ v2.Get("/user", handler) // /api/v2/user
+
+ // ...
+}
+
+```
+
+### 中介模組記錄器
+
+📖 [記錄器](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"))
+}
+```
+
+### 跨原始來源資源共用 (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` 標頭傳入任何網域來檢查 CORS 的效果:
+
+```bash
+curl -H "Origin: http://example.com" --verbose http://localhost:3000
+```
+
+### 自訂 404 回應
+
+📖 [HTTP 方法](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!")
+ })
+
+ // 最後一個中介模組,符合所有條件
+ app.Use(func(c *fiber.Ctx) error {
+ return c.SendStatus(404)
+ // => 404 "Not Found"
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### JSON 回應
+
+📖 [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 升級 (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
+
+📖 [更多資訊](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 - 目前時間為 %v", i, time.Now())
+ fmt.Fprintf(w, "data: 訊息: %s\n\n", msg)
+ fmt.Println(msg)
+
+ w.Flush()
+ time.Sleep(5 * time.Second)
+ }
+ }))
+
+ return nil
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+### Recover 中介模組
+
+📖 [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("正常來說,這會導致 app 當機")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+### 使用信任的代理伺服器
+
+📖 [組態設定](https://docs.gofiber.io/api/fiber#config)
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/recover"
+)
+
+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,
+ })
+
+ // ...
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+
+
+## 🧬 內建中介模組
+
+這裡列出了 Fiber 框架內建的中介模組。
+
+| 中介模組 | 描述 |
+| :------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | 提供 HTTP Basic 認證的基本認證中介模組。如果憑證有效,則會呼叫接續函式 (next);如果沒有憑證或失效,則回傳 401 Unauthorized。 |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | 攔截並快取回應。 |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | 適用於 Fiber 的壓縮中介模組。預設支援 `deflate`、`gzip` 和 `brotli`。 |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | 啟用跨來源資源共用 (CORS),可調整多種選項。 |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | 保護資源防止 CSRF 利用。 |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | 加密中介模組,會將 Cookie 的值進行加密。 |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar) | 公開環境變數,並提供可調整設定。 |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag 中介模組,讓快取更高效,同時因為 Web 伺服器不需要在內容未更動時重新傳送完整請求,因此可以減少流量使用。 |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar 中介模組,透過其 HTTP 伺服器執行階段,提供 JSON 格式的公用變數。 |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | 不輸出 Favicons 請求記錄;若有提供檔案路徑,則從記憶體提供圖示。 |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | 適用於 Fiber 的檔案系統中介模組。特別銘謝 Alireza Salary! |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | 適用於 Fiber 的速率限制中介模組。用來限制傳入公開 API 或者(以及)端點(如密碼重設)的重複請求。 |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP 請求/回應記錄工具。 |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | 監控中介模組,用來回報伺服器指標。啟發自 express-status-monitor。 |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | 特別感謝 Matthew Lee \(@mthli\) |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | 讓您可以將請求代理 (proxy) 至多台伺服器。 |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover 中介模組:可以從呼叫堆疊鏈中任何部分的當機 (panic) 中復原,並將控制權交由中央的 [錯誤處理常式 (ErrorHandler)](https://docs.gofiber.io/guide/error-handling) 處理。 |
+| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | 為每個請求加上 requestid。 |
+| [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 標頭,協助保護您應用程式的安全。 |
+
+## 🧬 外掛中介模組
+
+這裡列出由 [Fiber 團隊](https://github.com/orgs/gofiber/people) 維護、存放在外部的中介模組。
+
+| 中介模組 | 描述 |
+| :------------------------------------------------ | :----------------------------------------------------------------------------------- |
+| [jwt](https://github.com/gofiber/jwt) | JWT 回傳 JSON Web Token \(JWT\) 認證中介模組。 |
+| [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)! |
+
+## 🕶️ Awesome List
+
+更多文章、中介模組、範例或工具,請參考我們的 [Awesome List](https://github.com/gofiber/awesome-fiber)。
+
+## 👍 貢獻
+
+如果您想和我們 **道謝**,或者是支持 `Fiber` 繼續積極開發下去(也可以兩個都做):
+
+1. 送給專案一顆 [GitHub 星星](https://github.com/gofiber/fiber/stargazers)。
+2. [在您的 𝕏 (Twitter) 上](https://x.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber)發出關於本專案的推文。
+3. 在 [Medium](https://medium.com/)、[Dev.to](https://dev.to/) 或者是個人部落格上寫下評論或教學。
+4. 捐專案 [一杯咖啡的費用](https://buymeacoff.ee/fenny) 以示支持。
+
+## ☕ 支持者
+
+Fiber 是個仰賴捐款的開放原始碼專案——用來支付如域名、Gitbook、Netlify 和無服務器運算服務的費用。如果您想支持 Fiber,可以在 ☕ [**這裡捐杯咖啡**](https://buymeacoff.ee/fenny)。
+
+| | 使用者 | 捐款 |
+| :--------------------------------------------------------- | :----------------------------------------------- | :------ |
+|  | [@destari](https://github.com/destari) | ☕ x 10 |
+|  | [@dembygenesis](https://github.com/dembygenesis) | ☕ x 5 |
+|  | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
+|  | [@hendratommy](https://github.com/hendratommy) | ☕ x 5 |
+|  | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
+|  | [@jorgefuertes](https://github.com/jorgefuertes) | ☕ x 5 |
+|  | [@candidosales](https://github.com/candidosales) | ☕ x 5 |
+|  | [@l0nax](https://github.com/l0nax) | ☕ x 3 |
+|  | [@bihe](https://github.com/bihe) | ☕ x 3 |
+|  | [@justdave](https://github.com/justdave) | ☕ x 3 |
+|  | [@koddr](https://github.com/koddr) | ☕ x 1 |
+|  | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
+|  | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
+|  | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
+|  | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
+|  | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
+|  | [@marvinjwendt](https://github.com/marvinjwendt) | ☕ x 1 |
+|  | [@toishy](https://github.com/toishy) | ☕ x 1 |
+
+## 💻 程式碼貢獻者
+
+
+
+## ⭐️ 收藏數
+
+
+
+## ⚠️ 授權條款
+
+著作權所有 (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) 授權,免費且開放原始碼的軟體。官方圖示 (logo) 由 [Vic Shóstak](https://github.com/koddr) 製作,並依據 [創用 CC](https://creativecommons.org/licenses/by-sa/4.0/) 授權條款散佈 (CC BY-SA 4.0 International)。
+
+**第三方函式庫的授權條款**
+
+- [colorable](https://github.com/mattn/go-colorable/blob/master/LICENSE)
+- [isatty](https://github.com/mattn/go-isatty/blob/master/LICENSE)
+- [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)
+- [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)
+- [msgp](https://github.com/tinylib/msgp/blob/master/LICENSE)
+- [schema](https://github.com/gorilla/schema/blob/master/LICENSE)
+- [uuid](https://github.com/google/uuid/blob/master/LICENSE)
+- [wmi](https://github.com/StackExchange/wmi/blob/master/LICENSE)
diff --git a/.github/SECURITY.md b/.github/SECURITY.md
new file mode 100644
index 0000000..9d4826f
--- /dev/null
+++ b/.github/SECURITY.md
@@ -0,0 +1,76 @@
+# Security Policy
+
+1. [Supported Versions](#versions)
+2. [Reporting security problems to Fiber](#reporting)
+3. [Security Point of Contact](#contact)
+4. [Incident Response Process](#process)
+
+
+## Supported Versions
+
+The table below shows the supported versions for Fiber which include security updates.
+
+| Version | Supported |
+| --------- | ------------------ |
+| >= 1.12.6 | :white_check_mark: |
+| < 1.12.6 | :x: |
+
+
+## Reporting security problems to Fiber
+
+**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://gofiber.io/discord) and send a private message
+to Fenny or any of the maintainers.
+
+
+## Security Point of Contact
+
+The security point of contact is [Fenny](https://github.com/Fenny). Fenny responds
+to security incident reports as fast as possible, within one business day at the
+latest.
+
+In case Fenny does not respond within a reasonable time, the secondary point
+of contact are any of the [@maintainers](https://github.com/orgs/gofiber/teams/maintainers).
+The maintainers are the only other persons with administrative access to Fiber's source code.
+
+
+## Incident Response Process
+
+In case an incident is discovered or reported, we will follow the following
+process to contain, respond and remediate:
+
+### 1. Containment
+
+The first step is to find out the root cause, nature and scope of the incident.
+
+- Is still ongoing? If yes, first priority is to stop it.
+- Is the incident outside of our influence? If yes, first priority is to contain it.
+- Find out knows about the incident and who is affected.
+- Find out what data was potentially exposed.
+
+### 2. Response
+
+After the initial assessment and containment to our best abilities, we will
+document all actions taken in a response plan.
+
+We will create a comment in the official `#announcements` channel to inform users about
+the incident and what actions we took to contain it.
+
+### 3. Remediation
+
+Once the incident is confirmed to be resolved, we will summarize the lessons
+learned from the incident and create a list of actions we will take to prevent
+it from happening again.
+
+### Secure accounts with access
+
+The [Fiber Organization](https://github.com/gofiber) requires 2FA authorization
+for all of it's members.
+
+### Critical Updates And Security Notices
+
+We learn about critical software updates and security threats from these sources
+
+1. GitHub Security Alerts
+2. GitHub: https://status.github.com/ & [@githubstatus](https://twitter.com/githubstatus)
diff --git a/.github/config.yml b/.github/config.yml
new file mode 100644
index 0000000..dff880c
--- /dev/null
+++ b/.github/config.yml
@@ -0,0 +1,17 @@
+# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
+# Comment to be posted to on first time issues
+newIssueWelcomeComment: >
+ Thanks for opening your first issue here! 🎉 Be sure to follow the issue template!
+ If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
+
+# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
+# Comment to be posted to on PRs from first time contributors in your repository
+newPRWelcomeComment: >
+ Thanks for opening this pull request! 🎉 Please check out our contributing guidelines.
+ If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
+
+# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
+# Comment to be posted to on pull requests merged by a first time user
+firstPRMergeComment: >
+ Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you!
+ If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..55253d3
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,16 @@
+# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+ - package-ecosystem: "gomod"
+ directory: "/" # Location of package manifests
+ labels:
+ - "🤖 Dependencies"
+ schedule:
+ interval: "daily"
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: daily
+ labels:
+ - "🤖 Dependencies"
diff --git a/.github/index.html b/.github/index.html
new file mode 100644
index 0000000..4115b43
--- /dev/null
+++ b/.github/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Test file
+
+
+
+ Hello, World!
+
+
+
\ No newline at end of file
diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 0000000..ea3e61d
--- /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
new file mode 100644
index 0000000..222b26d
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,31 @@
+## Description
+
+Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
+Explain the *details* for making this change. What existing problem does the pull request solve?
+
+Fixes # (issue)
+
+## Type of change
+
+Please delete options that are not relevant.
+
+- [ ] Bug fix (non-breaking change which fixes an issue)
+- [ ] New feature (non-breaking change which adds functionality)
+- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
+- [ ] This change requires a documentation update
+
+## Checklist:
+
+- [ ] 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 - /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)
+- [ ] I tried to make my code as fast as possible with as few allocations as possible
+- [ ] For new code I have written benchmarks so that they can be analyzed and improved
+
+## Commit formatting:
+
+Use emojis on commit messages so it provides an easy way of identifying the purpose or intention of a commit. Check out the emoji cheatsheet here: [CONTRIBUTING.md](https://github.com/gofiber/fiber/blob/master/.github/CONTRIBUTING.md#pull-requests-or-commits)
diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
new file mode 100644
index 0000000..c9af318
--- /dev/null
+++ b/.github/release-drafter.yml
@@ -0,0 +1,53 @@
+name-template: 'v$RESOLVED_VERSION'
+tag-template: 'v$RESOLVED_VERSION'
+commitish: v2
+filter-by-commitish: true
+include-labels:
+ - 'v2'
+exclude-labels:
+ - 'v3'
+categories:
+ - title: '❗ Breaking Changes'
+ labels:
+ - '❗ BreakingChange'
+ - title: '🚀 New'
+ labels:
+ - '✏️ Feature'
+ - title: '🧹 Updates'
+ labels:
+ - '🧹 Updates'
+ - '🤖 Dependencies'
+ - title: '🐛 Fixes'
+ labels:
+ - '☢️ Bug'
+ - title: '📚 Documentation'
+ labels:
+ - '📒 Documentation'
+change-template: '- $TITLE (#$NUMBER)'
+change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
+exclude-contributors:
+ - dependabot
+ - dependabot[bot]
+version-resolver:
+ major:
+ labels:
+ - 'major'
+ - '❗ BreakingChange'
+ minor:
+ labels:
+ - 'minor'
+ - '✏️ Feature'
+ patch:
+ labels:
+ - 'patch'
+ - '📒 Documentation'
+ - '☢️ Bug'
+ - '🤖 Dependencies'
+ - '🧹 Updates'
+ default: patch
+template: |
+ $CHANGES
+
+ **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
+
+ Thank you $CONTRIBUTORS for making this update possible.
diff --git a/.github/release.yml b/.github/release.yml
new file mode 100644
index 0000000..8f1601c
--- /dev/null
+++ b/.github/release.yml
@@ -0,0 +1,26 @@
+# .github/release.yml
+
+changelog:
+ categories:
+ - title: '❗ Breaking Changes'
+ labels:
+ - '❗ BreakingChange'
+ - title: '🚀 New Features'
+ labels:
+ - '✏️ Feature'
+ - '📝 Proposal'
+ - title: '🧹 Updates'
+ labels:
+ - '🧹 Updates'
+ - title: '🐛 Bug Fixes'
+ labels:
+ - '☢️ Bug'
+ - title: '🛠️ Maintenance'
+ labels:
+ - '🤖 Dependencies'
+ - title: '📚 Documentation'
+ labels:
+ - '📒 Documentation'
+ - title: 'Other Changes'
+ labels:
+ - '*'
diff --git a/.github/scripts/sync_docs.sh b/.github/scripts/sync_docs.sh
new file mode 100755
index 0000000..8175f26
--- /dev/null
+++ b/.github/scripts/sync_docs.sh
@@ -0,0 +1,75 @@
+#!/usr/bin/env bash
+set -e
+
+# 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
+#el
+if [ "$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
+ fi
+
+ # Run docusaurus versioning command
+ $DOCUSAURUS_COMMAND "${new_version}"
+
+ if [[ -f $VERSION_FILE ]]; then
+ jq 'sort | reverse' ${VERSION_FILE} > temp.json && mv temp.json ${VERSION_FILE}
+ fi
+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/testdata/ca-chain.cert.pem b/.github/testdata/ca-chain.cert.pem
new file mode 100644
index 0000000..90d9f30
--- /dev/null
+++ b/.github/testdata/ca-chain.cert.pem
@@ -0,0 +1,65 @@
+-----BEGIN CERTIFICATE-----
+MIIFeTCCA2GgAwIBAgIDEAISMA0GCSqGSIb3DQEBCwUAMFYxCzAJBgNVBAYTAlVT
+MQ8wDQYDVQQIDAZEZW5pYWwxFDASBgNVBAcMC1NwcmluZ2ZpZWxkMQwwCgYDVQQK
+DANEaXMxEjAQBgNVBAMMCWxvY2FsaG9zdDAeFw0yMjAyMDgyMDA3MjlaFw0zMjAy
+MDYyMDA3MjlaMEAxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIDAZEZW5pYWwxDDAKBgNV
+BAoMA0RpczESMBAGA1UEAwwJbG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOC
+Ag8AMIICCgKCAgEA5Cho0kbBDi1cy8bURStc95hK2RzjBQMd2hN5gFxZdF5knBfC
+LSiPMxtAn9zJYzYc9+Cq7hIOK19cgG4yKk9GFZaUe+mU4yWxRg1ViSu/jzQ04sVc
+JRSbSklXY1RNyxpUtGelxnluUvdvuXXlCPmKob4IsUtI1FTcumG1mzIO+cAzBd1J
+KQtNTUO9XfSHYusV/FQO2hIbaXcFgSAg50JJfYZaUw51J07j3vdb6lb1x4rRmIaq
+8txrdHo0Y2tXHsq6jry1QrOZfoz4WbYcoID3JU1MC5f1HyR5uYiCA1RJVGnQ3iSX
+3yM+gRy3SFPeaASs2useSzGkMr/pDlbcSVmsbXsasBxZq85T1FE8vuY6K4XlU2sN
+PyiPrNjDgVkQ8Lbj1B9oKEYKkmSieBx9YwRLarfru1kt+g3kdXuel7DyHpm+j/13
+vqjyF9DAyx4wAEZC+DzeqBsbuiDdRkzwFMcKPxYpgSTLawnCjlFapPvE5kGN+O/j
+To2qWbWUU/upzBvHu4tnICSapJJ0VqA+7M7yaBAsIWK/yjNTzpHfx0oHudl8wBOG
+ySfOE52uouFsp2vs06YpEg2nGn/7Iu0Rbbwt4iFcSZlEnSk0cQlyMZxdj3M2fMKa
+/nrRQm7guPbVmBJOFHZuTTiilNSduSsDwCjJkGdJkSVYbj3+eJzKwYstnT8CAwEA
+AaNmMGQwHQYDVR0OBBYEFHwli1hTCVJLHPTHWW8O8BCaHci9MB8GA1UdIwQYMBaA
+FDlb/7rpDA2ZzsLZmqbW/krUtmGOMBIGA1UdEwEB/wQIMAYBAf8CAQAwDgYDVR0P
+AQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBtMxa2/w6kGF9cmqpTdQ1La8nY
+R4Zoewnn+SCmcSOwCyBC32g0Ry6nKKUpJBpJEid5lBzWveIw4K7pdWvmuqmeMuWI
+ilvlCLzqYPigmnEIW96hc6XiQvl9NC5j+SAZSC+4uCNhEUx5pEbE1FU1gIX+szdJ
+tLdPwwg63Ce/us6QZ7Tx8qLIr+XU+DrCgjIheQFShtoNYDw0GxEtjeo8vHynj8EZ
++p0OZgqoNlnRbQbllruDFPXDJVI23DVhNpJhT86iQDMtMV53ypMu62LXmdQIKa7l
+ITnEMGO626RKqw2kDHt7yinBlt1nHskaeeLya6K/08uJkqRCjzOshJgsjQ3e62vQ
+Mht9QvGBCAoY09fIGxRihtTWCFDe7MEnbh1PPYB7cZTOMnL3wxRPzLLYhclX+pt0
+bBf7Dn84b3tdC5BFXBJeZMs5QSCvn4yrTew+NvvX3oL6Ny1JDZYaG5PhKf00J6iy
+TkXzK2n9U9RX+krPk8fU9Ae1nayD0vrmGaVcBdRQPn4XUuS3LhdlkHfr28z1nF9m
+ffd0WBrJlNX9SoKtsMj8VJFZ/nJ0EcCcY1mG3k/IGAY1HUeo4A+C5E/UO3h4+tOL
+uqUa8rkl9HoE4fIWdQVxtQjEdATSuJusaK7CFpWH8A0w9VchDx74saiwwGhVyXYk
+yBwSA5U88ymkQ7qNJg==
+-----END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIIFnTCCA4WgAwIBAgIUQnfvDIm6z+973AYRTLorZHEQA30wDQYJKoZIhvcNAQEL
+BQAwVjELMAkGA1UEBhMCVVMxDzANBgNVBAgMBkRlbmlhbDEUMBIGA1UEBwwLU3By
+aW5nZmllbGQxDDAKBgNVBAoMA0RpczESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTIy
+MDIwODIwMDcyOVoXDTQyMDIwMzIwMDcyOVowVjELMAkGA1UEBhMCVVMxDzANBgNV
+BAgMBkRlbmlhbDEUMBIGA1UEBwwLU3ByaW5nZmllbGQxDDAKBgNVBAoMA0RpczES
+MBAGA1UEAwwJbG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKC
+AgEA+Cf/fKPvI5+Nh81wpxghLrpAjM1MyhdHUDXc8bu7NTNYZ+6ArMqDeKSszTWT
+gLV9EeJs57KwjwXIoYZDTcLvpjanrZ2s7JDEqsGl7S6Xr67qzYghlF/GaB3f3lAi
+GsvhmDgC4jkdCvkVBKOB4tE0dy6fnNCmIKhhJDje51p90LWFuX5sIKO2trgte6b/
+P1PW8rOjedPd5Z+QCG4Mi8JnbJicX1YaOySGMcXHm/eM2wy5I3pEdUreZDFbjB7l
+CKa1kFAnDXBiQAoErggMlcXe6C+avB13wYCfi+R+9m2X0svmerSz+oHDCOhvnD52
+EE7fBv89VS6pR8mykz1eHiBKkVT1qdmONThUQ8mqwxlo06bZyoykKSxG6ffJnGbM
+GkTWlaNEdZuY0pITQLxEX2SwLJuZKfTPFheno83bLCqTOTuWo7h1mLe0ogJMxl//
+NHzyoMJ0b1bbrRgsLcMaDn1MsI+gVdRY89+cZ2uedEgrr7fl3KFWiF2S57bxX1fJ
+P8HC0bzMny4jMtIf6YUqDtpGDPjZq3PGqcrcO0dVYkuaC96H3xLcvQxgkMDK0sm0
+pUbWlECzAag/lxeeC22VnedqgCpiq/9z1b4j884ZkhIJyht0HR7L4I0gO/R/mWUY
+8bO9XCMYmP0CjO7u93IlzQ7aSIpWprTHxjpiPelmcO001jkCAwEAAaNjMGEwHQYD
+VR0OBBYEFDlb/7rpDA2ZzsLZmqbW/krUtmGOMB8GA1UdIwQYMBaAFDlb/7rpDA2Z
+zsLZmqbW/krUtmGOMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0G
+CSqGSIb3DQEBCwUAA4ICAQDk02Tu0ypqnS897WBx98l2nYIrEhcrJg8ZMmSwEa9J
+7TANofzsP9931YoQMh6BI6hB3OkyL6FYTUDykpGMMasojtL/F2iXEsjema2ilZ/7
+hNAZ+j5mBemMwXfkfmRguXvnl7EWaZETgEoxhcOTYoYUYqDcyzuwK63fOs+YA5ke
+O8E3F1aLHzLpqVpiG7t740L7LdibNPko9JOd31Gqcq3nhXMf6/rOdL8VSj/F+4BG
+opgJBruJV9NxWRI/b0G6eImvaYL/Ljfd8wzwNpmYkNkHbhAiaHeXJQ05mebmr2Dr
+wne9QeSJkXCs/K5A/8+0CYNN4homt8xNNN02SnJ5e6nv1A1ntMW9n6n2KYo87tz9
+VmqWXg7Y1BqXj287WRaWPJsBa2RBP1W2d3BQfHKJfu15blyXaczTi87WayEsBnQq
+TXy+1QP0IwQerSTOxdW25UoJmH18SRbLEIQs9Htvcpz2AncTYjeiLFa15FO2r5hP
+LYc9QOKn6yIZP9lYztleEqOLTmHnRnFcupDol+/x88d+kVLqmXDiKmWbVIz7C735
+xgImsyrCPPYYiEA7/yaP5G1o5XU93kRPrtg/7jjyF+uBZ70fcbED3prpuiJYrL0O
+gvQUgmGUU30mPHjAKkEACeRXtoqucRDxvIkBb5zUvZG8RmSFae5siAWwLD7D7VJa
+IA==
+-----END CERTIFICATE-----
diff --git a/.github/testdata/favicon.ico b/.github/testdata/favicon.ico
new file mode 100644
index 0000000..b752c26
Binary files /dev/null and b/.github/testdata/favicon.ico differ
diff --git a/.github/testdata/fs/css/style.css b/.github/testdata/fs/css/style.css
new file mode 100644
index 0000000..9085d4f
--- /dev/null
+++ b/.github/testdata/fs/css/style.css
@@ -0,0 +1,4 @@
+h1 {
+ color: red;
+ text-align: center;
+}
\ No newline at end of file
diff --git a/.github/testdata/fs/img/fiber.png b/.github/testdata/fs/img/fiber.png
new file mode 100644
index 0000000..fa981bc
Binary files /dev/null and b/.github/testdata/fs/img/fiber.png differ
diff --git a/.github/testdata/fs/index.html b/.github/testdata/fs/index.html
new file mode 100644
index 0000000..de64280
--- /dev/null
+++ b/.github/testdata/fs/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+ Document
+
+
+
+
Hello, World!
+
+
\ No newline at end of file
diff --git a/.github/testdata/index.html b/.github/testdata/index.html
new file mode 100644
index 0000000..cefca8f
--- /dev/null
+++ b/.github/testdata/index.html
@@ -0,0 +1 @@
+
Hello, Fiber!
\ No newline at end of file
diff --git a/.github/testdata/index.tmpl b/.github/testdata/index.tmpl
new file mode 100644
index 0000000..131044d
--- /dev/null
+++ b/.github/testdata/index.tmpl
@@ -0,0 +1 @@
+
{{.Title}}
\ No newline at end of file
diff --git a/.github/testdata/main.tmpl b/.github/testdata/main.tmpl
new file mode 100644
index 0000000..456d6bb
--- /dev/null
+++ b/.github/testdata/main.tmpl
@@ -0,0 +1 @@
+
I'm main
\ No newline at end of file
diff --git a/.github/testdata/ssl.key b/.github/testdata/ssl.key
new file mode 100644
index 0000000..cd9e251
--- /dev/null
+++ b/.github/testdata/ssl.key
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQD4IQusAs8PJdnG
+3mURt/AXtgC+ceqLOatJ49JJE1VPTkMAy+oE1f1XvkMrYsHqmDf6GWVzgVXryL4U
+wq2/nJSm56ddhN55nI8oSN3dtywUB8/ShelEN73nlN77PeD9tl6NksPwWaKrqxq0
+FlabRPZSQCfmgZbhDV8Sa8mfCkFU0G0lit6kLGceCKMvmW+9Bz7ebsYmVdmVMxmf
+IJStFD44lWFTdUc65WISKEdW2ELcUefb0zOLw+0PCbXFGJH5x5ktksW8+BBk2Hkg
+GeQRL/qPCccthbScO0VgNj3zJ3ZZL0ObSDAbvNDG85joeNjDNq5DT/BAZ0bOSbEF
+sh+f9BAzAgMBAAECggEBAJWv2cq7Jw6MVwSRxYca38xuD6TUNBopgBvjREixURW2
+sNUaLuMb9Omp7fuOaE2N5rcJ+xnjPGIxh/oeN5MQctz9gwn3zf6vY+15h97pUb4D
+uGvYPRDaT8YVGS+X9NMZ4ZCmqW2lpWzKnCFoGHcy8yZLbcaxBsRdvKzwOYGoPiFb
+K2QuhXZ/1UPmqK9i2DFKtj40X6vBszTNboFxOVpXrPu0FJwLVSDf2hSZ4fMM0DH3
+YqwKcYf5te+hxGKgrqRA3tn0NCWii0in6QIwXMC+kMw1ebg/tZKqyDLMNptAK8J+
+DVw9m5X1seUHS5ehU/g2jrQrtK5WYn7MrFK4lBzlRwECgYEA/d1TeANYECDWRRDk
+B0aaRZs87Rwl/J9PsvbsKvtU/bX+OfSOUjOa9iQBqn0LmU8GqusEET/QVUfocVwV
+Bggf/5qDLxz100Rj0ags/yE/kNr0Bb31kkkKHFMnCT06YasR7qKllwrAlPJvQv9x
+IzBKq+T/Dx08Wep9bCRSFhzRCnsCgYEA+jdeZXTDr/Vz+D2B3nAw1frqYFfGnEVY
+wqmoK3VXMDkGuxsloO2rN+SyiUo3JNiQNPDub/t7175GH5pmKtZOlftePANsUjBj
+wZ1D0rI5Bxu/71ibIUYIRVmXsTEQkh/ozoh3jXCZ9+bLgYiYx7789IUZZSokFQ3D
+FICUT9KJ36kCgYAGoq9Y1rWJjmIrYfqj2guUQC+CfxbbGIrrwZqAsRsSmpwvhZ3m
+tiSZxG0quKQB+NfSxdvQW5ulbwC7Xc3K35F+i9pb8+TVBdeaFkw+yu6vaZmxQLrX
+fQM/pEjD7A7HmMIaO7QaU5SfEAsqdCTP56Y8AftMuNXn/8IRfo2KuGwaWwKBgFpU
+ILzJoVdlad9E/Rw7LjYhZfkv1uBVXIyxyKcfrkEXZSmozDXDdxsvcZCEfVHM6Ipk
+K/+7LuMcqp4AFEAEq8wTOdq6daFaHLkpt/FZK6M4TlruhtpFOPkoNc3e45eM83OT
+6mziKINJC1CQ6m65sQHpBtjxlKMRG8rL/D6wx9s5AoGBAMRlqNPMwglT3hvDmsAt
+9Lf9pdmhERUlHhD8bj8mDaBj2Aqv7f6VRJaYZqP403pKKQexuqcn80mtjkSAPFkN
+Cj7BVt/RXm5uoxDTnfi26RF9F6yNDEJ7UU9+peBr99aazF/fTgW/1GcMkQnum8uV
+c257YgaWmjK9uB0Y2r2VxS0G
+-----END PRIVATE KEY-----
\ No newline at end of file
diff --git a/.github/testdata/ssl.pem b/.github/testdata/ssl.pem
new file mode 100644
index 0000000..4cf41c9
--- /dev/null
+++ b/.github/testdata/ssl.pem
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICujCCAaKgAwIBAgIJAMbXnKZ/cikUMA0GCSqGSIb3DQEBCwUAMBUxEzARBgNV
+BAMTCnVidW50dS5uYW4wHhcNMTUwMjA0MDgwMTM5WhcNMjUwMjAxMDgwMTM5WjAV
+MRMwEQYDVQQDEwp1YnVudHUubmFuMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEA+CELrALPDyXZxt5lEbfwF7YAvnHqizmrSePSSRNVT05DAMvqBNX9V75D
+K2LB6pg3+hllc4FV68i+FMKtv5yUpuenXYTeeZyPKEjd3bcsFAfP0oXpRDe955Te
++z3g/bZejZLD8Fmiq6satBZWm0T2UkAn5oGW4Q1fEmvJnwpBVNBtJYrepCxnHgij
+L5lvvQc+3m7GJlXZlTMZnyCUrRQ+OJVhU3VHOuViEihHVthC3FHn29Mzi8PtDwm1
+xRiR+ceZLZLFvPgQZNh5IBnkES/6jwnHLYW0nDtFYDY98yd2WS9Dm0gwG7zQxvOY
+6HjYwzauQ0/wQGdGzkmxBbIfn/QQMwIDAQABow0wCzAJBgNVHRMEAjAAMA0GCSqG
+SIb3DQEBCwUAA4IBAQBQjKm/4KN/iTgXbLTL3i7zaxYXFLXsnT1tF+ay4VA8aj98
+L3JwRTciZ3A5iy/W4VSCt3eASwOaPWHKqDBB5RTtL73LoAqsWmO3APOGQAbixcQ2
+45GXi05OKeyiYRi1Nvq7Unv9jUkRDHUYVPZVSAjCpsXzPhFkmZoTRxmx5l0ZF7Li
+K91lI5h+eFq0dwZwrmlPambyh1vQUi70VHv8DNToVU29kel7YLbxGbuqETfhrcy6
+X+Mha6RYITkAn5FqsZcKMsc9eYGEF4l3XV+oS7q6xfTxktYJMFTI18J0lQ2Lv/CI
+whdMnYGntDQBE/iFCrJEGNsKGc38796GBOb5j+zd
+-----END CERTIFICATE-----
\ No newline at end of file
diff --git a/.github/testdata/template-invalid.html b/.github/testdata/template-invalid.html
new file mode 100644
index 0000000..ac4f6d1
--- /dev/null
+++ b/.github/testdata/template-invalid.html
@@ -0,0 +1 @@
+
{{.Title}
diff --git a/.github/testdata/template.tmpl b/.github/testdata/template.tmpl
new file mode 100644
index 0000000..ab6e560
--- /dev/null
+++ b/.github/testdata/template.tmpl
@@ -0,0 +1 @@
+
{{.Title}} {{.Summary}}
\ No newline at end of file
diff --git a/.github/testdata/template/hello_world.gohtml b/.github/testdata/template/hello_world.gohtml
new file mode 100644
index 0000000..d47d8c5
--- /dev/null
+++ b/.github/testdata/template/hello_world.gohtml
@@ -0,0 +1 @@
+
", string(c.Response().Body()))
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_Get_Location_From_Route -benchmem -count=4
+func Benchmark_Ctx_Get_Location_From_Route(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ app.Get("/user/:name", func(c *Ctx) error {
+ return c.SendString(c.Params("name"))
+ }).Name("User")
+
+ var err error
+ var location string
+ for n := 0; n < b.N; n++ {
+ location, err = c.getLocationFromRoute(app.GetRoute("User"), Map{"name": "fiber"})
+ }
+ utils.AssertEqual(b, "/user/fiber", location)
+ utils.AssertEqual(b, nil, err)
+}
+
+// go test -run Test_Ctx_Get_Location_From_Route_name
+func Test_Ctx_Get_Location_From_Route_name(t *testing.T) {
+ t.Parallel()
+
+ t.Run("case insensitive", func(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ app.Get("/user/:name", func(c *Ctx) error {
+ return c.SendString(c.Params("name"))
+ }).Name("User")
+
+ location, err := c.GetRouteURL("User", Map{"name": "fiber"})
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "/user/fiber", location)
+
+ location, err = c.GetRouteURL("User", Map{"Name": "fiber"})
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "/user/fiber", location)
+ })
+
+ t.Run("case sensitive", func(t *testing.T) {
+ t.Parallel()
+ app := New(Config{CaseSensitive: true})
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ app.Get("/user/:name", func(c *Ctx) error {
+ return c.SendString(c.Params("name"))
+ }).Name("User")
+
+ location, err := c.GetRouteURL("User", Map{"name": "fiber"})
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "/user/fiber", location)
+
+ location, err = c.GetRouteURL("User", Map{"Name": "fiber"})
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "/user/", location)
+ })
+}
+
+// go test -run Test_Ctx_Get_Location_From_Route_name_Optional_greedy
+func Test_Ctx_Get_Location_From_Route_name_Optional_greedy(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ app.Get("/:phone/*/send/*", func(c *Ctx) error {
+ return c.SendString("Phone: " + c.Params("phone") + "\nFirst Param: " + c.Params("*1") + "\nSecond Param: " + c.Params("*2"))
+ }).Name("SendSms")
+
+ location, err := c.GetRouteURL("SendSms", Map{
+ "phone": "23456789",
+ "*1": "sms",
+ "*2": "test-msg",
+ })
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "/23456789/sms/send/test-msg", location)
+}
+
+// go test -run Test_Ctx_Get_Location_From_Route_name_Optional_greedy_one_param
+func Test_Ctx_Get_Location_From_Route_name_Optional_greedy_one_param(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ app.Get("/:phone/*/send", func(c *Ctx) error {
+ return c.SendString("Phone: " + c.Params("phone") + "\nFirst Param: " + c.Params("*1"))
+ }).Name("SendSms")
+
+ location, err := c.GetRouteURL("SendSms", Map{
+ "phone": "23456789",
+ "*": "sms",
+ })
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "/23456789/sms/send", location)
+}
+
+type errorTemplateEngine struct{}
+
+func (errorTemplateEngine) Render(_ io.Writer, _ string, _ interface{}, _ ...string) error {
+ return errors.New("errorTemplateEngine")
+}
+
+func (errorTemplateEngine) Load() error { return nil }
+
+// go test -run Test_Ctx_Render_Engine_Error
+func Test_Ctx_Render_Engine_Error(t *testing.T) {
+ t.Parallel()
+ app := New()
+ app.config.Views = errorTemplateEngine{}
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ err := c.Render("index.tmpl", nil)
+ utils.AssertEqual(t, false, err == nil)
+}
+
+// go test -run Test_Ctx_Render_Go_Template
+func Test_Ctx_Render_Go_Template(t *testing.T) {
+ t.Parallel()
+ file, err := os.CreateTemp(os.TempDir(), "fiber")
+ utils.AssertEqual(t, nil, err)
+ defer func() {
+ err := os.Remove(file.Name())
+ utils.AssertEqual(t, nil, err)
+ }()
+
+ _, err = file.Write([]byte("template"))
+ utils.AssertEqual(t, nil, err)
+
+ err = file.Close()
+ utils.AssertEqual(t, nil, err)
+
+ app := New()
+
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ err = c.Render(file.Name(), nil)
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "template", string(c.Response().Body()))
+}
+
+// go test -run Test_Ctx_Send
+func Test_Ctx_Send(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ utils.AssertEqual(t, nil, c.Send([]byte("Hello, World")))
+ utils.AssertEqual(t, nil, c.Send([]byte("Don't crash please")))
+ utils.AssertEqual(t, nil, c.Send([]byte("1337")))
+ utils.AssertEqual(t, "1337", string(c.Response().Body()))
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_Send -benchmem -count=4
+func Benchmark_Ctx_Send(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ byt := []byte("Hello, World!")
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ var err error
+ for n := 0; n < b.N; n++ {
+ err = c.Send(byt)
+ }
+ utils.AssertEqual(b, nil, err)
+ utils.AssertEqual(b, "Hello, World!", string(c.Response().Body()))
+}
+
+// go test -run Test_Ctx_SendStatus
+func Test_Ctx_SendStatus(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ err := c.SendStatus(415)
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, 415, c.Response().StatusCode())
+ utils.AssertEqual(t, "Unsupported Media Type", string(c.Response().Body()))
+}
+
+// go test -run Test_Ctx_SendString
+func Test_Ctx_SendString(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ err := c.SendString("Don't crash please")
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "Don't crash please", string(c.Response().Body()))
+}
+
+// go test -run Test_Ctx_SendStream
+func Test_Ctx_SendStream(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ err := c.SendStream(bytes.NewReader([]byte("Don't crash please")))
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "Don't crash please", string(c.Response().Body()))
+
+ err = c.SendStream(bytes.NewReader([]byte("Don't crash please")), len([]byte("Don't crash please")))
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "Don't crash please", string(c.Response().Body()))
+
+ err = c.SendStream(bufio.NewReader(bytes.NewReader([]byte("Hello bufio"))))
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "Hello bufio", string(c.Response().Body()))
+}
+
+// go test -run Test_Ctx_Set
+func Test_Ctx_Set(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ c.Set("X-1", "1")
+ c.Set("X-2", "2")
+ c.Set("X-3", "3")
+ c.Set("X-3", "1337")
+ utils.AssertEqual(t, "1", string(c.Response().Header.Peek("x-1")))
+ utils.AssertEqual(t, "2", string(c.Response().Header.Peek("x-2")))
+ utils.AssertEqual(t, "1337", string(c.Response().Header.Peek("x-3")))
+}
+
+// go test -run Test_Ctx_Set_Splitter
+func Test_Ctx_Set_Splitter(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ c.Set("Location", "foo\r\nSet-Cookie:%20SESSIONID=MaliciousValue\r\n")
+ h := string(c.Response().Header.Peek("Location"))
+ utils.AssertEqual(t, false, strings.Contains(h, "\r\n"), h)
+
+ c.Set("Location", "foo\nSet-Cookie:%20SESSIONID=MaliciousValue\n")
+ h = string(c.Response().Header.Peek("Location"))
+ utils.AssertEqual(t, false, strings.Contains(h, "\n"), h)
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_Set -benchmem -count=4
+func Benchmark_Ctx_Set(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ val := "1431-15132-3423"
+ b.ReportAllocs()
+ b.ResetTimer()
+ for n := 0; n < b.N; n++ {
+ c.Set(HeaderXRequestID, val)
+ }
+}
+
+// go test -run Test_Ctx_Status
+func Test_Ctx_Status(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ c.Status(400)
+ utils.AssertEqual(t, 400, c.Response().StatusCode())
+ err := c.Status(415).Send([]byte("Hello, World"))
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, 415, c.Response().StatusCode())
+ utils.AssertEqual(t, "Hello, World", string(c.Response().Body()))
+}
+
+// go test -run Test_Ctx_Type
+func Test_Ctx_Type(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ c.Type(".json")
+ utils.AssertEqual(t, "application/json", string(c.Response().Header.Peek("Content-Type")))
+
+ c.Type("json", "utf-8")
+ utils.AssertEqual(t, "application/json; charset=utf-8", string(c.Response().Header.Peek("Content-Type")))
+
+ c.Type(".html")
+ utils.AssertEqual(t, "text/html", string(c.Response().Header.Peek("Content-Type")))
+
+ c.Type("html", "utf-8")
+ utils.AssertEqual(t, "text/html; charset=utf-8", string(c.Response().Header.Peek("Content-Type")))
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_Type -benchmem -count=4
+func Benchmark_Ctx_Type(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ b.ReportAllocs()
+ b.ResetTimer()
+ for n := 0; n < b.N; n++ {
+ c.Type(".json")
+ c.Type("json")
+ }
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_Type_Charset -benchmem -count=4
+func Benchmark_Ctx_Type_Charset(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ b.ReportAllocs()
+ b.ResetTimer()
+ for n := 0; n < b.N; n++ {
+ c.Type(".json", "utf-8")
+ c.Type("json", "utf-8")
+ }
+}
+
+// go test -run Test_Ctx_Vary
+func Test_Ctx_Vary(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ c.Vary("Origin")
+ c.Vary("User-Agent")
+ c.Vary("Accept-Encoding", "Accept")
+ utils.AssertEqual(t, "Origin, User-Agent, Accept-Encoding, Accept", string(c.Response().Header.Peek("Vary")))
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_Vary -benchmem -count=4
+func Benchmark_Ctx_Vary(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ b.ReportAllocs()
+ b.ResetTimer()
+ for n := 0; n < b.N; n++ {
+ c.Vary("Origin", "User-Agent")
+ }
+}
+
+// go test -run Test_Ctx_Write
+func Test_Ctx_Write(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ _, err := c.Write([]byte("Hello, "))
+ utils.AssertEqual(t, nil, err)
+ _, err = c.Write([]byte("World!"))
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "Hello, World!", string(c.Response().Body()))
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_Write -benchmem -count=4
+func Benchmark_Ctx_Write(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ byt := []byte("Hello, World!")
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ var err error
+ for n := 0; n < b.N; n++ {
+ _, err = c.Write(byt)
+ }
+ utils.AssertEqual(b, nil, err)
+}
+
+// go test -run Test_Ctx_Writef
+func Test_Ctx_Writef(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ world := "World!"
+ _, err := c.Writef("Hello, %s", world)
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "Hello, World!", string(c.Response().Body()))
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_Writef -benchmem -count=4
+func Benchmark_Ctx_Writef(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ world := "World!"
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ var err error
+ for n := 0; n < b.N; n++ {
+ _, err = c.Writef("Hello, %s", world)
+ }
+ utils.AssertEqual(b, nil, err)
+}
+
+// go test -run Test_Ctx_WriteString
+func Test_Ctx_WriteString(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ _, err := c.WriteString("Hello, ")
+ utils.AssertEqual(t, nil, err)
+ _, err = c.WriteString("World!")
+ utils.AssertEqual(t, nil, err)
+ utils.AssertEqual(t, "Hello, World!", string(c.Response().Body()))
+}
+
+// go test -run Test_Ctx_XHR
+func Test_Ctx_XHR(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ c.Request().Header.Set(HeaderXRequestedWith, "XMLHttpRequest")
+ utils.AssertEqual(t, true, c.XHR())
+}
+
+// go test -run=^$ -bench=Benchmark_Ctx_XHR -benchmem -count=4
+func Benchmark_Ctx_XHR(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ c.Request().Header.Set(HeaderXRequestedWith, "XMLHttpRequest")
+ var equal bool
+ b.ReportAllocs()
+ b.ResetTimer()
+ for n := 0; n < b.N; n++ {
+ equal = c.XHR()
+ }
+ utils.AssertEqual(b, true, equal)
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_SendString_B -benchmem -count=4
+func Benchmark_Ctx_SendString_B(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ body := "Hello, world!"
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ var err error
+ for n := 0; n < b.N; n++ {
+ err = c.SendString(body)
+ }
+ utils.AssertEqual(b, nil, err)
+ utils.AssertEqual(b, []byte("Hello, world!"), c.Response().Body())
+}
+
+// go test -run Test_Ctx_Queries -v
+func Test_Ctx_Queries(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball,football&favouriteDrinks=milo,coke,pepsi&alloc=&no=1&field1=value1&field1=value2&field2=value3&list_a=1&list_a=2&list_a=3&list_b[]=1&list_b[]=2&list_b[]=3&list_c=1,2,3")
+
+ queries := c.Queries()
+ utils.AssertEqual(t, "1", queries["id"])
+ utils.AssertEqual(t, "tom", queries["name"])
+ utils.AssertEqual(t, "basketball,football", queries["hobby"])
+ utils.AssertEqual(t, "milo,coke,pepsi", queries["favouriteDrinks"])
+ utils.AssertEqual(t, "", queries["alloc"])
+ utils.AssertEqual(t, "1", queries["no"])
+ utils.AssertEqual(t, "value2", queries["field1"])
+ utils.AssertEqual(t, "value3", queries["field2"])
+ utils.AssertEqual(t, "3", queries["list_a"])
+ utils.AssertEqual(t, "3", queries["list_b[]"])
+ utils.AssertEqual(t, "1,2,3", queries["list_c"])
+
+ c.Request().URI().SetQueryString("filters.author.name=John&filters.category.name=Technology&filters[customer][name]=Alice&filters[status]=pending")
+
+ queries = c.Queries()
+ utils.AssertEqual(t, "John", queries["filters.author.name"])
+ utils.AssertEqual(t, "Technology", queries["filters.category.name"])
+ utils.AssertEqual(t, "Alice", queries["filters[customer][name]"])
+ utils.AssertEqual(t, "pending", queries["filters[status]"])
+
+ c.Request().URI().SetQueryString("tags=apple,orange,banana&filters[tags]=apple,orange,banana&filters[category][name]=fruits&filters.tags=apple,orange,banana&filters.category.name=fruits")
+
+ queries = c.Queries()
+ utils.AssertEqual(t, "apple,orange,banana", queries["tags"])
+ utils.AssertEqual(t, "apple,orange,banana", queries["filters[tags]"])
+ utils.AssertEqual(t, "fruits", queries["filters[category][name]"])
+ utils.AssertEqual(t, "apple,orange,banana", queries["filters.tags"])
+ utils.AssertEqual(t, "fruits", queries["filters.category.name"])
+
+ c.Request().URI().SetQueryString("filters[tags][0]=apple&filters[tags][1]=orange&filters[tags][2]=banana&filters[category][name]=fruits")
+
+ queries = c.Queries()
+ utils.AssertEqual(t, "apple", queries["filters[tags][0]"])
+ utils.AssertEqual(t, "orange", queries["filters[tags][1]"])
+ utils.AssertEqual(t, "banana", queries["filters[tags][2]"])
+ utils.AssertEqual(t, "fruits", queries["filters[category][name]"])
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_Queries -benchmem -count=4
+func Benchmark_Ctx_Queries(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ b.ReportAllocs()
+ b.ResetTimer()
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball,football&favouriteDrinks=milo,coke,pepsi&alloc=&no=1")
+
+ var queries map[string]string
+ for n := 0; n < b.N; n++ {
+ queries = c.Queries()
+ }
+
+ utils.AssertEqual(b, "1", queries["id"])
+ utils.AssertEqual(b, "tom", queries["name"])
+ utils.AssertEqual(b, "basketball,football", queries["hobby"])
+ utils.AssertEqual(b, "milo,coke,pepsi", queries["favouriteDrinks"])
+ utils.AssertEqual(b, "", queries["alloc"])
+ utils.AssertEqual(b, "1", queries["no"])
+}
+
+// go test -run Test_Ctx_QueryParser -v
+func Test_Ctx_QueryParser(t *testing.T) {
+ t.Parallel()
+ app := New(Config{EnableSplittingOnParsers: true})
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type Query struct {
+ ID int
+ Name string
+ Hobby []string
+ }
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball&hobby=football")
+ q := new(Query)
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+ utils.AssertEqual(t, 2, len(q.Hobby))
+
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball,football")
+ q = new(Query)
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+ utils.AssertEqual(t, 2, len(q.Hobby))
+
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=scoccer&hobby=basketball,football")
+ q = new(Query)
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+ utils.AssertEqual(t, 3, len(q.Hobby))
+
+ empty := new(Query)
+ c.Request().URI().SetQueryString("")
+ utils.AssertEqual(t, nil, c.QueryParser(empty))
+ utils.AssertEqual(t, 0, len(empty.Hobby))
+
+ c.Request().URI().SetQueryString("id=1&name[=tom")
+ q = new(Query)
+ utils.AssertEqual(t, "unmatched brackets", c.QueryParser(q).Error())
+
+ type Query2 struct {
+ Bool bool
+ ID int
+ Name string
+ Hobby string
+ FavouriteDrinks []string
+ Empty []string
+ Alloc []string
+ No []int64
+ }
+
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball,football&favouriteDrinks=milo,coke,pepsi&alloc=&no=1")
+ q2 := new(Query2)
+ q2.Bool = true
+ q2.Name = "hello world 1"
+ utils.AssertEqual(t, nil, c.QueryParser(q2))
+ utils.AssertEqual(t, "basketball,football", q2.Hobby)
+ utils.AssertEqual(t, true, q2.Bool)
+ utils.AssertEqual(t, "tom", q2.Name) // check value get overwritten
+ utils.AssertEqual(t, []string{"milo", "coke", "pepsi"}, q2.FavouriteDrinks)
+ var nilSlice []string
+ utils.AssertEqual(t, nilSlice, q2.Empty)
+ utils.AssertEqual(t, []string{""}, q2.Alloc)
+ utils.AssertEqual(t, []int64{1}, q2.No)
+
+ type RequiredQuery struct {
+ Name string `query:"name,required"`
+ }
+ rq := new(RequiredQuery)
+ c.Request().URI().SetQueryString("")
+ utils.AssertEqual(t, "failed to decode: name is empty", c.QueryParser(rq).Error())
+
+ type ArrayQuery struct {
+ Data []string
+ }
+ aq := new(ArrayQuery)
+ c.Request().URI().SetQueryString("data[]=john&data[]=doe")
+ utils.AssertEqual(t, nil, c.QueryParser(aq))
+ utils.AssertEqual(t, 2, len(aq.Data))
+}
+
+// go test -run Test_Ctx_QueryParserUsingTag -v
+func Test_Ctx_QueryParserUsingTag(t *testing.T) {
+ t.Parallel()
+ app := New(Config{EnableSplittingOnParsers: true})
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type Query struct {
+ ID int `query:"id"`
+ Name string `query:"name"`
+ Hobby []string `query:"hobby"`
+ }
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball&hobby=football")
+ q := new(Query)
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+ utils.AssertEqual(t, 2, len(q.Hobby))
+
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball,football")
+ q = new(Query)
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+ utils.AssertEqual(t, 2, len(q.Hobby))
+
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=scoccer&hobby=basketball,football")
+ q = new(Query)
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+ utils.AssertEqual(t, 3, len(q.Hobby))
+
+ empty := new(Query)
+ c.Request().URI().SetQueryString("")
+ utils.AssertEqual(t, nil, c.QueryParser(empty))
+ utils.AssertEqual(t, 0, len(empty.Hobby))
+
+ type Query2 struct {
+ Bool bool `query:"bool"`
+ ID int `query:"id"`
+ Name string `query:"name"`
+ Hobby string `query:"hobby"`
+ FavouriteDrinks []string `query:"favouriteDrinks"`
+ Empty []string `query:"empty"`
+ Alloc []string `query:"alloc"`
+ No []int64 `query:"no"`
+ }
+
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball,football&favouriteDrinks=milo,coke,pepsi&alloc=&no=1")
+ q2 := new(Query2)
+ q2.Bool = true
+ q2.Name = "hello world 2"
+ utils.AssertEqual(t, nil, c.QueryParser(q2))
+ utils.AssertEqual(t, "basketball,football", q2.Hobby)
+ utils.AssertEqual(t, true, q2.Bool)
+ utils.AssertEqual(t, "tom", q2.Name) // check value get overwritten
+ utils.AssertEqual(t, []string{"milo", "coke", "pepsi"}, q2.FavouriteDrinks)
+ var nilSlice []string
+ utils.AssertEqual(t, nilSlice, q2.Empty)
+ utils.AssertEqual(t, []string{""}, q2.Alloc)
+ utils.AssertEqual(t, []int64{1}, q2.No)
+
+ type RequiredQuery struct {
+ Name string `query:"name,required"`
+ }
+ rq := new(RequiredQuery)
+ c.Request().URI().SetQueryString("")
+ utils.AssertEqual(t, "failed to decode: name is empty", c.QueryParser(rq).Error())
+
+ type ArrayQuery struct {
+ Data []string
+ }
+ aq := new(ArrayQuery)
+ c.Request().URI().SetQueryString("data[]=john&data[]=doe")
+ utils.AssertEqual(t, nil, c.QueryParser(aq))
+ utils.AssertEqual(t, 2, len(aq.Data))
+}
+
+// go test -run Test_Ctx_QueryParser -v
+func Test_Ctx_QueryParser_WithoutSplitting(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type Query struct {
+ ID int
+ Name string
+ Hobby []string
+ }
+
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball,football")
+ q := new(Query)
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+ utils.AssertEqual(t, 1, len(q.Hobby))
+
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=scoccer&hobby=basketball,football")
+ q = new(Query)
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+ utils.AssertEqual(t, 2, len(q.Hobby))
+}
+
+// go test -run Test_Ctx_QueryParser_WithSetParserDecoder -v
+func Test_Ctx_QueryParser_WithSetParserDecoder(t *testing.T) {
+ type NonRFCTime time.Time
+
+ nonRFCConverter := func(value string) reflect.Value {
+ if v, err := time.Parse("2006-01-02", value); err == nil {
+ return reflect.ValueOf(v)
+ }
+ return reflect.Value{}
+ }
+
+ nonRFCTime := ParserType{
+ Customtype: NonRFCTime{},
+ Converter: nonRFCConverter,
+ }
+
+ SetParserDecoder(ParserConfig{
+ IgnoreUnknownKeys: true,
+ ParserType: []ParserType{nonRFCTime},
+ ZeroEmpty: true,
+ SetAliasTag: "query",
+ })
+
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ type NonRFCTimeInput struct {
+ Date NonRFCTime `query:"date"`
+ Title string `query:"title"`
+ Body string `query:"body"`
+ }
+
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+ q := new(NonRFCTimeInput)
+
+ c.Request().URI().SetQueryString("date=2021-04-10&title=CustomDateTest&Body=October")
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+ utils.AssertEqual(t, "CustomDateTest", q.Title)
+ date := fmt.Sprintf("%v", q.Date)
+ utils.AssertEqual(t, "{0 63753609600 }", date)
+ utils.AssertEqual(t, "October", q.Body)
+
+ c.Request().URI().SetQueryString("date=2021-04-10&title&Body=October")
+ q = &NonRFCTimeInput{
+ Title: "Existing title",
+ Body: "Existing Body",
+ }
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+ utils.AssertEqual(t, "", q.Title)
+}
+
+// go test -run Test_Ctx_QueryParser_Schema -v
+func Test_Ctx_QueryParser_Schema(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type Query1 struct {
+ Name string `query:"name,required"`
+ Nested struct {
+ Age int `query:"age"`
+ } `query:"nested,required"`
+ }
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+ c.Request().URI().SetQueryString("name=tom&nested.age=10")
+ q := new(Query1)
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+
+ c.Request().URI().SetQueryString("namex=tom&nested.age=10")
+ q = new(Query1)
+ utils.AssertEqual(t, "failed to decode: name is empty", c.QueryParser(q).Error())
+
+ c.Request().URI().SetQueryString("name=tom&nested.agex=10")
+ q = new(Query1)
+ utils.AssertEqual(t, nil, c.QueryParser(q))
+
+ c.Request().URI().SetQueryString("name=tom&test.age=10")
+ q = new(Query1)
+ utils.AssertEqual(t, "failed to decode: nested is empty", c.QueryParser(q).Error())
+
+ type Query2 struct {
+ Name string `query:"name"`
+ Nested struct {
+ Age int `query:"age,required"`
+ } `query:"nested"`
+ }
+ c.Request().URI().SetQueryString("name=tom&nested.age=10")
+ q2 := new(Query2)
+ utils.AssertEqual(t, nil, c.QueryParser(q2))
+
+ c.Request().URI().SetQueryString("nested.age=10")
+ q2 = new(Query2)
+ utils.AssertEqual(t, nil, c.QueryParser(q2))
+
+ c.Request().URI().SetQueryString("nested.agex=10")
+ q2 = new(Query2)
+ utils.AssertEqual(t, "failed to decode: nested.age is empty", c.QueryParser(q2).Error())
+
+ c.Request().URI().SetQueryString("nested.agex=10")
+ q2 = new(Query2)
+ utils.AssertEqual(t, "failed to decode: nested.age is empty", c.QueryParser(q2).Error())
+
+ type Node struct {
+ Value int `query:"val,required"`
+ Next *Node `query:"next,required"`
+ }
+ c.Request().URI().SetQueryString("val=1&next.val=3")
+ n := new(Node)
+ utils.AssertEqual(t, nil, c.QueryParser(n))
+ utils.AssertEqual(t, 1, n.Value)
+ utils.AssertEqual(t, 3, n.Next.Value)
+
+ c.Request().URI().SetQueryString("next.val=2")
+ n = new(Node)
+ utils.AssertEqual(t, "failed to decode: val is empty", c.QueryParser(n).Error())
+
+ c.Request().URI().SetQueryString("val=3&next.value=2")
+ n = new(Node)
+ n.Next = new(Node)
+ utils.AssertEqual(t, nil, c.QueryParser(n))
+ utils.AssertEqual(t, 3, n.Value)
+ utils.AssertEqual(t, 0, n.Next.Value)
+
+ type Person struct {
+ Name string `query:"name"`
+ Age int `query:"age"`
+ }
+
+ type CollectionQuery struct {
+ Data []Person `query:"data"`
+ }
+
+ c.Request().URI().SetQueryString("data[0][name]=john&data[0][age]=10&data[1][name]=doe&data[1][age]=12")
+ cq := new(CollectionQuery)
+ utils.AssertEqual(t, nil, c.QueryParser(cq))
+ utils.AssertEqual(t, 2, len(cq.Data))
+ utils.AssertEqual(t, "john", cq.Data[0].Name)
+ utils.AssertEqual(t, 10, cq.Data[0].Age)
+ utils.AssertEqual(t, "doe", cq.Data[1].Name)
+ utils.AssertEqual(t, 12, cq.Data[1].Age)
+
+ c.Request().URI().SetQueryString("data[0][name]=john&data[0][age]=10&data[1]name]=doe&data[1][age]=12")
+ cq = new(CollectionQuery)
+ utils.AssertEqual(t, "unmatched brackets", c.QueryParser(cq).Error())
+
+ c.Request().URI().SetQueryString("data.0.name=john&data.0.age=10&data.1.name=doe&data.1.age=12")
+ cq = new(CollectionQuery)
+ utils.AssertEqual(t, nil, c.QueryParser(cq))
+ utils.AssertEqual(t, 2, len(cq.Data))
+ utils.AssertEqual(t, "john", cq.Data[0].Name)
+ utils.AssertEqual(t, 10, cq.Data[0].Age)
+ utils.AssertEqual(t, "doe", cq.Data[1].Name)
+ utils.AssertEqual(t, 12, cq.Data[1].Age)
+}
+
+// go test -run Test_Ctx_ReqHeaderParser -v
+func Test_Ctx_ReqHeaderParser(t *testing.T) {
+ t.Parallel()
+ app := New(Config{EnableSplittingOnParsers: true})
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type Header struct {
+ ID int
+ Name string
+ Hobby []string
+ }
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+
+ c.Request().Header.Add("id", "1")
+ c.Request().Header.Add("Name", "John Doe")
+ c.Request().Header.Add("Hobby", "golang,fiber")
+ q := new(Header)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(q))
+ utils.AssertEqual(t, 2, len(q.Hobby))
+
+ c.Request().Header.Del("hobby")
+ c.Request().Header.Add("Hobby", "golang,fiber,go")
+ q = new(Header)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(q))
+ utils.AssertEqual(t, 3, len(q.Hobby))
+
+ empty := new(Header)
+ c.Request().Header.Del("hobby")
+ utils.AssertEqual(t, nil, c.QueryParser(empty))
+ utils.AssertEqual(t, 0, len(empty.Hobby))
+
+ type Header2 struct {
+ Bool bool
+ ID int
+ Name string
+ Hobby string
+ FavouriteDrinks []string
+ Empty []string
+ Alloc []string
+ No []int64
+ }
+
+ c.Request().Header.Add("id", "2")
+ c.Request().Header.Add("Name", "Jane Doe")
+ c.Request().Header.Del("hobby")
+ c.Request().Header.Add("Hobby", "go,fiber")
+ c.Request().Header.Add("favouriteDrinks", "milo,coke,pepsi")
+ c.Request().Header.Add("alloc", "")
+ c.Request().Header.Add("no", "1")
+
+ h2 := new(Header2)
+ h2.Bool = true
+ h2.Name = "hello world 3"
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(h2))
+ utils.AssertEqual(t, "go,fiber", h2.Hobby)
+ utils.AssertEqual(t, true, h2.Bool)
+ utils.AssertEqual(t, "Jane Doe", h2.Name) // check value get overwritten
+ utils.AssertEqual(t, []string{"milo", "coke", "pepsi"}, h2.FavouriteDrinks)
+ var nilSlice []string
+ utils.AssertEqual(t, nilSlice, h2.Empty)
+ utils.AssertEqual(t, []string{""}, h2.Alloc)
+ utils.AssertEqual(t, []int64{1}, h2.No)
+
+ type RequiredHeader struct {
+ Name string `reqHeader:"name,required"`
+ }
+ rh := new(RequiredHeader)
+ c.Request().Header.Del("name")
+ utils.AssertEqual(t, "failed to decode: name is empty", c.ReqHeaderParser(rh).Error())
+}
+
+// go test -run Test_Ctx_ReqHeaderParserUsingTag -v
+func Test_Ctx_ReqHeaderParserUsingTag(t *testing.T) {
+ t.Parallel()
+ app := New(Config{EnableSplittingOnParsers: true})
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type Header struct {
+ ID int `reqHeader:"id"`
+ Name string `reqHeader:"name"`
+ Hobby []string `reqHeader:"hobby"`
+ Address []string `reqHeader:"x-secure-address"`
+ }
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+
+ c.Request().Header.Add("id", "1")
+ c.Request().Header.Add("Name", "John Doe")
+ c.Request().Header.Add("Hobby", "golang,fiber")
+ c.Request().Header.Add("x-secure-address", "1st,2st")
+ q := new(Header)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(q))
+ utils.AssertEqual(t, 2, len(q.Hobby))
+ utils.AssertEqual(t, 2, len(q.Address))
+
+ c.Request().Header.Del("hobby")
+ c.Request().Header.Add("Hobby", "golang,fiber,go")
+ q = new(Header)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(q))
+ utils.AssertEqual(t, 3, len(q.Hobby))
+
+ empty := new(Header)
+ c.Request().Header.Del("hobby")
+ utils.AssertEqual(t, nil, c.QueryParser(empty))
+ utils.AssertEqual(t, 0, len(empty.Hobby))
+
+ type Header2 struct {
+ Bool bool `reqHeader:"bool"`
+ ID int `reqHeader:"id"`
+ Name string `reqHeader:"name"`
+ Hobby string `reqHeader:"hobby"`
+ FavouriteDrinks []string `reqHeader:"favouriteDrinks"`
+ Empty []string `reqHeader:"empty"`
+ Alloc []string `reqHeader:"alloc"`
+ No []int64 `reqHeader:"no"`
+ }
+
+ c.Request().Header.Add("id", "2")
+ c.Request().Header.Add("Name", "Jane Doe")
+ c.Request().Header.Del("hobby")
+ c.Request().Header.Add("Hobby", "go,fiber")
+ c.Request().Header.Add("favouriteDrinks", "milo,coke,pepsi")
+ c.Request().Header.Add("alloc", "")
+ c.Request().Header.Add("no", "1")
+
+ h2 := new(Header2)
+ h2.Bool = true
+ h2.Name = "hello world 4"
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(h2))
+ utils.AssertEqual(t, "go,fiber", h2.Hobby)
+ utils.AssertEqual(t, true, h2.Bool)
+ utils.AssertEqual(t, "Jane Doe", h2.Name) // check value get overwritten
+ utils.AssertEqual(t, []string{"milo", "coke", "pepsi"}, h2.FavouriteDrinks)
+ var nilSlice []string
+ utils.AssertEqual(t, nilSlice, h2.Empty)
+ utils.AssertEqual(t, []string{""}, h2.Alloc)
+ utils.AssertEqual(t, []int64{1}, h2.No)
+
+ type RequiredHeader struct {
+ Name string `reqHeader:"name,required"`
+ }
+ rh := new(RequiredHeader)
+ c.Request().Header.Del("name")
+ utils.AssertEqual(t, "failed to decode: name is empty", c.ReqHeaderParser(rh).Error())
+}
+
+// go test -run Test_Ctx_ReqHeaderParser -v
+func Test_Ctx_ReqHeaderParser_WithoutSplitting(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type Header struct {
+ ID int
+ Name string
+ Hobby []string
+ }
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+
+ c.Request().Header.Add("id", "1")
+ c.Request().Header.Add("Name", "John Doe")
+ c.Request().Header.Add("Hobby", "golang,fiber")
+ q := new(Header)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(q))
+ utils.AssertEqual(t, 1, len(q.Hobby))
+
+ c.Request().Header.Del("hobby")
+ c.Request().Header.Add("Hobby", "golang,fiber,go")
+ q = new(Header)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(q))
+ utils.AssertEqual(t, 1, len(q.Hobby))
+}
+
+// go test -run Test_Ctx_ReqHeaderParser_WithSetParserDecoder -v
+func Test_Ctx_ReqHeaderParser_WithSetParserDecoder(t *testing.T) {
+ type NonRFCTime time.Time
+
+ nonRFCConverter := func(value string) reflect.Value {
+ if v, err := time.Parse("2006-01-02", value); err == nil {
+ return reflect.ValueOf(v)
+ }
+ return reflect.Value{}
+ }
+
+ nonRFCTime := ParserType{
+ Customtype: NonRFCTime{},
+ Converter: nonRFCConverter,
+ }
+
+ SetParserDecoder(ParserConfig{
+ IgnoreUnknownKeys: true,
+ ParserType: []ParserType{nonRFCTime},
+ ZeroEmpty: true,
+ SetAliasTag: "req",
+ })
+
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ type NonRFCTimeInput struct {
+ Date NonRFCTime `req:"date"`
+ Title string `req:"title"`
+ Body string `req:"body"`
+ }
+
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+ r := new(NonRFCTimeInput)
+
+ c.Request().Header.Add("Date", "2021-04-10")
+ c.Request().Header.Add("Title", "CustomDateTest")
+ c.Request().Header.Add("Body", "October")
+
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(r))
+ utils.AssertEqual(t, "CustomDateTest", r.Title)
+ date := fmt.Sprintf("%v", r.Date)
+ utils.AssertEqual(t, "{0 63753609600 }", date)
+ utils.AssertEqual(t, "October", r.Body)
+
+ c.Request().Header.Add("Title", "")
+ r = &NonRFCTimeInput{
+ Title: "Existing title",
+ Body: "Existing Body",
+ }
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(r))
+ utils.AssertEqual(t, "", r.Title)
+}
+
+// go test -run Test_Ctx_ReqHeaderParser_Schema -v
+func Test_Ctx_ReqHeaderParser_Schema(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type Header1 struct {
+ Name string `reqHeader:"Name,required"`
+ Nested struct {
+ Age int `reqHeader:"Age"`
+ } `reqHeader:"Nested,required"`
+ }
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+
+ c.Request().Header.Add("Name", "tom")
+ c.Request().Header.Add("Nested.Age", "10")
+ q := new(Header1)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(q))
+
+ c.Request().Header.Del("Name")
+ q = new(Header1)
+ utils.AssertEqual(t, "failed to decode: Name is empty", c.ReqHeaderParser(q).Error())
+
+ c.Request().Header.Add("Name", "tom")
+ c.Request().Header.Del("Nested.Age")
+ c.Request().Header.Add("Nested.Agex", "10")
+ q = new(Header1)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(q))
+
+ c.Request().Header.Del("Nested.Agex")
+ q = new(Header1)
+ utils.AssertEqual(t, "failed to decode: Nested is empty", c.ReqHeaderParser(q).Error())
+
+ c.Request().Header.Del("Nested.Agex")
+ c.Request().Header.Del("Name")
+
+ type Header2 struct {
+ Name string `reqHeader:"Name"`
+ Nested struct {
+ Age int `reqHeader:"age,required"`
+ } `reqHeader:"Nested"`
+ }
+
+ c.Request().Header.Add("Name", "tom")
+ c.Request().Header.Add("Nested.Age", "10")
+
+ h2 := new(Header2)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(h2))
+
+ c.Request().Header.Del("Name")
+ h2 = new(Header2)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(h2))
+
+ c.Request().Header.Del("Name")
+ c.Request().Header.Del("Nested.Age")
+ c.Request().Header.Add("Nested.Agex", "10")
+ h2 = new(Header2)
+ utils.AssertEqual(t, "failed to decode: Nested.age is empty", c.ReqHeaderParser(h2).Error())
+
+ type Node struct {
+ Value int `reqHeader:"Val,required"`
+ Next *Node `reqHeader:"Next,required"`
+ }
+ c.Request().Header.Add("Val", "1")
+ c.Request().Header.Add("Next.Val", "3")
+ n := new(Node)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(n))
+ utils.AssertEqual(t, 1, n.Value)
+ utils.AssertEqual(t, 3, n.Next.Value)
+
+ c.Request().Header.Del("Val")
+ n = new(Node)
+ utils.AssertEqual(t, "failed to decode: Val is empty", c.ReqHeaderParser(n).Error())
+
+ c.Request().Header.Add("Val", "3")
+ c.Request().Header.Del("Next.Val")
+ c.Request().Header.Add("Next.Value", "2")
+ n = new(Node)
+ n.Next = new(Node)
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(n))
+ utils.AssertEqual(t, 3, n.Value)
+ utils.AssertEqual(t, 0, n.Next.Value)
+}
+
+// go test -run Test_Ctx_EqualFieldTypeOfRequestQuery
+func Test_Ctx_EqualFieldTypeOfRequestQuery(t *testing.T) {
+ t.Parallel()
+ var out int
+ utils.AssertEqual(t, false, equalFieldType(&out, reflect.Int, "key", queryTag))
+
+ var dummy struct{ f string }
+ utils.AssertEqual(t, false, equalFieldType(&dummy, reflect.String, "key", queryTag))
+
+ var dummy2 struct{ f string }
+ utils.AssertEqual(t, false, equalFieldType(&dummy2, reflect.String, "f", queryTag))
+
+ var user struct {
+ Name string
+ Address string `query:"address"`
+ Age int `query:"AGE"`
+ }
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "name", queryTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "Name", queryTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "address", queryTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "Address", queryTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.Int, "AGE", queryTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.Int, "age", queryTag))
+}
+
+// go test -run Test_Ctx_EqualFieldTypeOfRequestHeader
+func Test_Ctx_EqualFieldTypeOfRequestHeader(t *testing.T) {
+ t.Parallel()
+ var out int
+ utils.AssertEqual(t, false, equalFieldType(&out, reflect.Int, "key", reqHeaderTag))
+
+ var dummy struct{ f string }
+ utils.AssertEqual(t, false, equalFieldType(&dummy, reflect.String, "key", reqHeaderTag))
+
+ var dummy2 struct{ f string }
+ utils.AssertEqual(t, false, equalFieldType(&dummy2, reflect.String, "f", reqHeaderTag))
+
+ var user struct {
+ Name string
+ Address string `reqHeader:"address"`
+ Age int `reqHeader:"AGE"`
+ }
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "name", reqHeaderTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "Name", reqHeaderTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "address", reqHeaderTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "Address", reqHeaderTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.Int, "AGE", reqHeaderTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.Int, "age", reqHeaderTag))
+}
+
+// go test -run Test_Ctx_EqualFieldTypeOfRequestBody
+func Test_Ctx_EqualFieldTypeOfRequestBody(t *testing.T) {
+ t.Parallel()
+ var out int
+ utils.AssertEqual(t, false, equalFieldType(&out, reflect.Int, "key", bodyTag))
+
+ var dummy struct{ f string }
+ utils.AssertEqual(t, false, equalFieldType(&dummy, reflect.String, "key", bodyTag))
+
+ var dummy2 struct{ f string }
+ utils.AssertEqual(t, false, equalFieldType(&dummy2, reflect.String, "f", bodyTag))
+
+ var user struct {
+ Name string
+ Address string `form:"address"`
+ Age int `form:"AGE"`
+ }
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "name", bodyTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "Name", bodyTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "address", bodyTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "Address", bodyTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.Int, "AGE", bodyTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.Int, "age", bodyTag))
+}
+
+// go test -run Test_Ctx_EqualFieldTypeOfRequestParams
+func Test_Ctx_EqualFieldTypeOfRequestParams(t *testing.T) {
+ t.Parallel()
+ var out int
+ utils.AssertEqual(t, false, equalFieldType(&out, reflect.Int, "key", paramsTag))
+
+ var dummy struct{ f string }
+ utils.AssertEqual(t, false, equalFieldType(&dummy, reflect.String, "key", paramsTag))
+
+ var dummy2 struct{ f string }
+ utils.AssertEqual(t, false, equalFieldType(&dummy2, reflect.String, "f", paramsTag))
+
+ var user struct {
+ Name string
+ Address string `params:"address"`
+ Age int `params:"AGE"`
+ }
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "name", paramsTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "Name", paramsTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "address", paramsTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.String, "Address", paramsTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.Int, "AGE", paramsTag))
+ utils.AssertEqual(t, true, equalFieldType(&user, reflect.Int, "age", paramsTag))
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_QueryParser -benchmem -count=4
+func Benchmark_Ctx_QueryParser(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type Query struct {
+ ID int
+ Name string
+ Hobby []string
+ }
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball&hobby=football")
+ q := new(Query)
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ var err error
+ for n := 0; n < b.N; n++ {
+ err = c.QueryParser(q)
+ }
+ utils.AssertEqual(b, nil, err)
+ utils.AssertEqual(b, nil, c.QueryParser(q))
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_parseQuery -benchmem -count=4
+func Benchmark_Ctx_parseQuery(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type Person struct {
+ Name string `query:"name"`
+ Age int `query:"age"`
+ }
+
+ type CollectionQuery struct {
+ Data []Person `query:"data"`
+ }
+
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+ c.Request().URI().SetQueryString("data[0][name]=john&data[0][age]=10")
+ cq := new(CollectionQuery)
+
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ var err error
+ for n := 0; n < b.N; n++ {
+ err = c.QueryParser(cq)
+ }
+
+ utils.AssertEqual(b, nil, err)
+ utils.AssertEqual(b, nil, c.QueryParser(cq))
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_QueryParser_Comma -benchmem -count=4
+func Benchmark_Ctx_QueryParser_Comma(b *testing.B) {
+ app := New(Config{EnableSplittingOnParsers: true})
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type Query struct {
+ ID int
+ Name string
+ Hobby []string
+ }
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+ // c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball&hobby=football")
+ c.Request().URI().SetQueryString("id=1&name=tom&hobby=basketball,football")
+ q := new(Query)
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ var err error
+ for n := 0; n < b.N; n++ {
+ err = c.QueryParser(q)
+ }
+ utils.AssertEqual(b, nil, err)
+ utils.AssertEqual(b, nil, c.QueryParser(q))
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_ReqHeaderParser -benchmem -count=4
+func Benchmark_Ctx_ReqHeaderParser(b *testing.B) {
+ app := New(Config{EnableSplittingOnParsers: true})
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ type ReqHeader struct {
+ ID int
+ Name string
+ Hobby []string
+ }
+ c.Request().SetBody([]byte(``))
+ c.Request().Header.SetContentType("")
+
+ c.Request().Header.Add("id", "1")
+ c.Request().Header.Add("Name", "John Doe")
+ c.Request().Header.Add("Hobby", "golang,fiber")
+
+ q := new(ReqHeader)
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ var err error
+ for n := 0; n < b.N; n++ {
+ err = c.ReqHeaderParser(q)
+ }
+ utils.AssertEqual(b, nil, err)
+ utils.AssertEqual(b, nil, c.ReqHeaderParser(q))
+}
+
+// go test -run Test_Ctx_BodyStreamWriter
+func Test_Ctx_BodyStreamWriter(t *testing.T) {
+ t.Parallel()
+ ctx := &fasthttp.RequestCtx{}
+
+ ctx.SetBodyStreamWriter(func(w *bufio.Writer) {
+ fmt.Fprintf(w, "body writer line 1\n")
+ if err := w.Flush(); err != nil {
+ t.Errorf("unexpected error: %s", err)
+ }
+ fmt.Fprintf(w, "body writer line 2\n")
+ })
+
+ utils.AssertEqual(t, true, ctx.IsBodyStream())
+
+ s := ctx.Response.String()
+ br := bufio.NewReader(bytes.NewBufferString(s))
+ var resp fasthttp.Response
+ utils.AssertEqual(t, nil, resp.Read(br))
+
+ body := string(resp.Body())
+ expectedBody := "body writer line 1\nbody writer line 2\n"
+ utils.AssertEqual(t, expectedBody, body)
+}
+
+// go test -v -run=^$ -bench=Benchmark_Ctx_BodyStreamWriter -benchmem -count=4
+func Benchmark_Ctx_BodyStreamWriter(b *testing.B) {
+ ctx := &fasthttp.RequestCtx{}
+ user := []byte(`{"name":"john"}`)
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ var err error
+ for n := 0; n < b.N; n++ {
+ ctx.ResetBody()
+ ctx.SetBodyStreamWriter(func(w *bufio.Writer) {
+ for i := 0; i < 10; i++ {
+ _, err = w.Write(user)
+ if err := w.Flush(); err != nil {
+ return
+ }
+ }
+ })
+ }
+ utils.AssertEqual(b, nil, err)
+}
+
+func Test_Ctx_String(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ utils.AssertEqual(t, "#0000000000000000 - 0.0.0.0:0 <-> 0.0.0.0:0 - GET http:///", c.String())
+}
+
+func TestCtx_ParamsInt(t *testing.T) {
+ // Create a test context and set some strings (or params)
+ // create a fake app to be used within this test
+ t.Parallel()
+ app := New()
+
+ // Create some test endpoints
+
+ // For the user id I will use the number 1111, so I should be able to get the number
+ // 1111 from the Ctx
+ app.Get("/test/:user", func(c *Ctx) error {
+ // utils.AssertEqual(t, "john", c.Params("user"))
+
+ num, err := c.ParamsInt("user")
+
+ // Check the number matches
+ utils.AssertEqual(t, 1111, num)
+
+ // Check no errors are returned, because we want NO errors in this one
+ utils.AssertEqual(t, nil, err)
+
+ return nil
+ })
+
+ // In this test case, there will be a bad request where the expected number is NOT
+ // a number in the path
+ app.Get("/testnoint/:user", func(c *Ctx) error {
+ // utils.AssertEqual(t, "john", c.Params("user"))
+
+ num, err := c.ParamsInt("user")
+
+ // Check the number matches
+ utils.AssertEqual(t, 0, num)
+
+ // Check an error is returned, because we want NO errors in this one
+ utils.AssertEqual(t, true, err != nil)
+
+ return nil
+ })
+
+ // For the user id I will use the number 2222, so I should be able to get the number
+ // 2222 from the Ctx even when the default value is specified
+ app.Get("/testignoredefault/:user", func(c *Ctx) error {
+ // utils.AssertEqual(t, "john", c.Params("user"))
+
+ num, err := c.ParamsInt("user", 1111)
+
+ // Check the number matches
+ utils.AssertEqual(t, 2222, num)
+
+ // Check no errors are returned, because we want NO errors in this one
+ utils.AssertEqual(t, nil, err)
+
+ return nil
+ })
+
+ // In this test case, there will be a bad request where the expected number is NOT
+ // a number in the path, default value of 1111 should be used instead
+ app.Get("/testdefault/:user", func(c *Ctx) error {
+ // utils.AssertEqual(t, "john", c.Params("user"))
+
+ num, err := c.ParamsInt("user", 1111)
+
+ // Check the number matches
+ utils.AssertEqual(t, 1111, num)
+
+ // Check an error is returned, because we want NO errors in this one
+ utils.AssertEqual(t, nil, err)
+
+ return nil
+ })
+
+ _, err := app.Test(httptest.NewRequest(MethodGet, "/test/1111", nil))
+ utils.AssertEqual(t, nil, err)
+
+ _, err = app.Test(httptest.NewRequest(MethodGet, "/testnoint/xd", nil))
+ utils.AssertEqual(t, nil, err)
+
+ _, err = app.Test(httptest.NewRequest(MethodGet, "/testignoredefault/2222", nil))
+ utils.AssertEqual(t, nil, err)
+
+ _, err = app.Test(httptest.NewRequest(MethodGet, "/testdefault/xd", nil))
+ utils.AssertEqual(t, nil, err)
+}
+
+// go test -run Test_Ctx_GetRespHeader
+func Test_Ctx_GetRespHeader(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ c.Set("test", "Hello, World 👋!")
+ c.Response().Header.Set(HeaderContentType, "application/json")
+ utils.AssertEqual(t, c.GetRespHeader("test"), "Hello, World 👋!")
+ utils.AssertEqual(t, c.GetRespHeader(HeaderContentType), "application/json")
+}
+
+// go test -run Test_Ctx_GetRespHeaders
+func Test_Ctx_GetRespHeaders(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ c.Set("test", "Hello, World 👋!")
+ c.Set("foo", "bar")
+ c.Response().Header.Set("multi", "one")
+ c.Response().Header.Add("multi", "two")
+ c.Response().Header.Set(HeaderContentType, "application/json")
+
+ utils.AssertEqual(t, c.GetRespHeaders(), map[string][]string{
+ "Content-Type": {"application/json"},
+ "Foo": {"bar"},
+ "Multi": {"one", "two"},
+ "Test": {"Hello, World 👋!"},
+ })
+}
+
+func Benchmark_Ctx_GetRespHeaders(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ c.Response().Header.Set("test", "Hello, World 👋!")
+ c.Response().Header.Set("foo", "bar")
+ c.Response().Header.Set(HeaderContentType, "application/json")
+
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ var headers map[string][]string
+ for n := 0; n < b.N; n++ {
+ headers = c.GetRespHeaders()
+ }
+
+ utils.AssertEqual(b, headers, map[string][]string{
+ "Content-Type": {"application/json"},
+ "Foo": {"bar"},
+ "Test": {"Hello, World 👋!"},
+ })
+}
+
+// go test -run Test_Ctx_GetReqHeaders
+func Test_Ctx_GetReqHeaders(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ c.Request().Header.Set("test", "Hello, World 👋!")
+ c.Request().Header.Set("foo", "bar")
+ c.Request().Header.Set("multi", "one")
+ c.Request().Header.Add("multi", "two")
+ c.Request().Header.Set(HeaderContentType, "application/json")
+
+ utils.AssertEqual(t, c.GetReqHeaders(), map[string][]string{
+ "Content-Type": {"application/json"},
+ "Foo": {"bar"},
+ "Test": {"Hello, World 👋!"},
+ "Multi": {"one", "two"},
+ })
+}
+
+func Benchmark_Ctx_GetReqHeaders(b *testing.B) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ c.Request().Header.Set("test", "Hello, World 👋!")
+ c.Request().Header.Set("foo", "bar")
+ c.Request().Header.Set(HeaderContentType, "application/json")
+
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ var headers map[string][]string
+ for n := 0; n < b.N; n++ {
+ headers = c.GetReqHeaders()
+ }
+
+ utils.AssertEqual(b, headers, map[string][]string{
+ "Content-Type": {"application/json"},
+ "Foo": {"bar"},
+ "Test": {"Hello, World 👋!"},
+ })
+}
+
+// go test -run Test_Ctx_IsFromLocal_X_Forwarded
+func Test_Ctx_IsFromLocal_X_Forwarded(t *testing.T) {
+ t.Parallel()
+ // Test unset X-Forwarded-For header.
+ {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ // fasthttp returns "0.0.0.0" as IP as there is no remote address.
+ utils.AssertEqual(t, "0.0.0.0", c.IP())
+ utils.AssertEqual(t, false, c.IsFromLocal())
+ }
+ // Test when setting X-Forwarded-For header to localhost "127.0.0.1"
+ {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ c.Request().Header.Set(HeaderXForwardedFor, "127.0.0.1")
+ defer app.ReleaseCtx(c)
+ utils.AssertEqual(t, false, c.IsFromLocal())
+ }
+ // Test when setting X-Forwarded-For header to localhost "::1"
+ {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ c.Request().Header.Set(HeaderXForwardedFor, "::1")
+ defer app.ReleaseCtx(c)
+ utils.AssertEqual(t, false, c.IsFromLocal())
+ }
+ // Test when setting X-Forwarded-For to full localhost IPv6 address "0:0:0:0:0:0:0:1"
+ {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ c.Request().Header.Set(HeaderXForwardedFor, "0:0:0:0:0:0:0:1")
+ defer app.ReleaseCtx(c)
+ utils.AssertEqual(t, false, c.IsFromLocal())
+ }
+ // Test for a random IP address.
+ {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ c.Request().Header.Set(HeaderXForwardedFor, "93.46.8.90")
+ defer app.ReleaseCtx(c)
+ utils.AssertEqual(t, false, c.IsFromLocal())
+ }
+}
+
+// go test -run Test_Ctx_IsFromLocal_RemoteAddr
+func Test_Ctx_IsFromLocal_RemoteAddr(t *testing.T) {
+ t.Parallel()
+
+ localIPv4 := net.Addr(&net.TCPAddr{IP: net.ParseIP("127.0.0.1")})
+ localIPv6 := net.Addr(&net.TCPAddr{IP: net.ParseIP("::1")})
+ localIPv6long := net.Addr(&net.TCPAddr{IP: net.ParseIP("0:0:0:0:0:0:0:1")})
+
+ zeroIPv4 := net.Addr(&net.TCPAddr{IP: net.IPv4zero})
+
+ someIPv4 := net.Addr(&net.TCPAddr{IP: net.ParseIP("93.46.8.90")})
+ someIPv6 := net.Addr(&net.TCPAddr{IP: net.ParseIP("2001:0db8:85a3:0000:0000:8a2e:0370:7334")})
+
+ // Test for the case fasthttp remoteAddr is set to "127.0.0.1".
+ {
+ app := New()
+ fastCtx := &fasthttp.RequestCtx{}
+ fastCtx.SetRemoteAddr(localIPv4)
+ c := app.AcquireCtx(fastCtx)
+ defer app.ReleaseCtx(c)
+
+ utils.AssertEqual(t, "127.0.0.1", c.IP())
+ utils.AssertEqual(t, true, c.IsFromLocal())
+ }
+ // Test for the case fasthttp remoteAddr is set to "::1".
+ {
+ app := New()
+ fastCtx := &fasthttp.RequestCtx{}
+ fastCtx.SetRemoteAddr(localIPv6)
+ c := app.AcquireCtx(fastCtx)
+ defer app.ReleaseCtx(c)
+ utils.AssertEqual(t, "::1", c.IP())
+ utils.AssertEqual(t, true, c.IsFromLocal())
+ }
+ // Test for the case fasthttp remoteAddr is set to "0:0:0:0:0:0:0:1".
+ {
+ app := New()
+ fastCtx := &fasthttp.RequestCtx{}
+ fastCtx.SetRemoteAddr(localIPv6long)
+ c := app.AcquireCtx(fastCtx)
+ defer app.ReleaseCtx(c)
+ // fasthttp should return "::1" for "0:0:0:0:0:0:0:1".
+ // otherwise IsFromLocal() will break.
+ utils.AssertEqual(t, "::1", c.IP())
+ utils.AssertEqual(t, true, c.IsFromLocal())
+ }
+ // Test for the case fasthttp remoteAddr is set to "0.0.0.0".
+ {
+ app := New()
+ fastCtx := &fasthttp.RequestCtx{}
+ fastCtx.SetRemoteAddr(zeroIPv4)
+ c := app.AcquireCtx(fastCtx)
+ defer app.ReleaseCtx(c)
+ utils.AssertEqual(t, "0.0.0.0", c.IP())
+ utils.AssertEqual(t, false, c.IsFromLocal())
+ }
+ // Test for the case fasthttp remoteAddr is set to "93.46.8.90".
+ {
+ app := New()
+ fastCtx := &fasthttp.RequestCtx{}
+ fastCtx.SetRemoteAddr(someIPv4)
+ c := app.AcquireCtx(fastCtx)
+ defer app.ReleaseCtx(c)
+ utils.AssertEqual(t, "93.46.8.90", c.IP())
+ utils.AssertEqual(t, false, c.IsFromLocal())
+ }
+ // Test for the case fasthttp remoteAddr is set to "2001:0db8:85a3:0000:0000:8a2e:0370:7334".
+ {
+ app := New()
+ fastCtx := &fasthttp.RequestCtx{}
+ fastCtx.SetRemoteAddr(someIPv6)
+ c := app.AcquireCtx(fastCtx)
+ defer app.ReleaseCtx(c)
+ utils.AssertEqual(t, "2001:db8:85a3::8a2e:370:7334", c.IP())
+ utils.AssertEqual(t, false, c.IsFromLocal())
+ }
+}
+
+// go test -run Test_Ctx_RepeatParserWithSameStruct -v
+func Test_Ctx_RepeatParserWithSameStruct(t *testing.T) {
+ t.Parallel()
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+
+ type Request struct {
+ QueryParam string `query:"query_param"`
+ HeaderParam string `reqHeader:"header_param"`
+ BodyParam string `json:"body_param" xml:"body_param" form:"body_param"`
+ }
+
+ r := new(Request)
+
+ c.Request().URI().SetQueryString("query_param=query_param")
+ utils.AssertEqual(t, nil, c.QueryParser(r))
+ utils.AssertEqual(t, "query_param", r.QueryParam)
+
+ c.Request().Header.Add("header_param", "header_param")
+ utils.AssertEqual(t, nil, c.ReqHeaderParser(r))
+ utils.AssertEqual(t, "header_param", r.HeaderParam)
+
+ var gzipJSON bytes.Buffer
+ w := gzip.NewWriter(&gzipJSON)
+ _, _ = w.Write([]byte(`{"body_param":"body_param"}`)) //nolint:errcheck // This will never fail
+ err := w.Close()
+ utils.AssertEqual(t, nil, err)
+ c.Request().Header.SetContentType(MIMEApplicationJSON)
+ c.Request().Header.Set(HeaderContentEncoding, "gzip")
+ c.Request().SetBody(gzipJSON.Bytes())
+ c.Request().Header.SetContentLength(len(gzipJSON.Bytes()))
+ utils.AssertEqual(t, nil, c.BodyParser(r))
+ utils.AssertEqual(t, "body_param", r.BodyParam)
+ c.Request().Header.Del(HeaderContentEncoding)
+
+ testDecodeParser := func(contentType, body string) {
+ c.Request().Header.SetContentType(contentType)
+ c.Request().SetBody([]byte(body))
+ c.Request().Header.SetContentLength(len(body))
+ utils.AssertEqual(t, nil, c.BodyParser(r))
+ utils.AssertEqual(t, "body_param", r.BodyParam)
+ }
+
+ testDecodeParser(MIMEApplicationJSON, `{"body_param":"body_param"}`)
+ testDecodeParser(MIMEApplicationXML, `body_param`)
+ testDecodeParser(MIMEApplicationForm, "body_param=body_param")
+ testDecodeParser(MIMEMultipartForm+`;boundary="b"`, "--b\r\nContent-Disposition: form-data; name=\"body_param\"\r\n\r\nbody_param\r\n--b--")
+}
+
+// go test -run Test_Ctx_extractIPsFromHeader -v
+func Test_Ctx_extractIPsFromHeader(t *testing.T) {
+ app := New()
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ c.Request().Header.Set("x-forwarded-for", "1.1.1.1,8.8.8.8 , /n, \n,1.1, a.c, 6.,6., , a,,42.118.81.169,10.0.137.108")
+ ips := c.IPs()
+ res := ips[len(ips)-2]
+ utils.AssertEqual(t, "42.118.81.169", res)
+}
+
+// go test -run Test_Ctx_extractIPsFromHeader -v
+func Test_Ctx_extractIPsFromHeader_EnableValidateIp(t *testing.T) {
+ app := New()
+ app.config.EnableIPValidation = true
+ c := app.AcquireCtx(&fasthttp.RequestCtx{})
+ defer app.ReleaseCtx(c)
+ c.Request().Header.Set("x-forwarded-for", "1.1.1.1,8.8.8.8 , /n, \n,1.1, a.c, 6.,6., , a,,42.118.81.169,10.0.137.108")
+ ips := c.IPs()
+ res := ips[len(ips)-2]
+ utils.AssertEqual(t, "42.118.81.169", res)
+}
diff --git a/docs/api/_category_.json b/docs/api/_category_.json
new file mode 100644
index 0000000..c0fc663
--- /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 0000000..cb38f70
--- /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
+
+
+
+## Mount
+
+You can Mount Fiber instance by creating a `*Mount`
+
+```go title="Signature"
+func (a *App) Mount(prefix string, app *App) Router
+```
+
+```go title="Examples"
+func main() {
+ app := fiber.New()
+ micro := fiber.New()
+ app.Mount("/john", micro) // GET /john/doe -> 200 OK
+
+ micro.Get("/doe", func(c *fiber.Ctx) error {
+ return c.SendStatus(fiber.StatusOK)
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+## MountPath
+
+The `MountPath` property contains one or more path patterns on which a sub-app was mounted.
+
+```go title="Signature"
+func (app *App) MountPath() string
+```
+
+```go title="Examples"
+func main() {
+ app := fiber.New()
+ one := fiber.New()
+ two := fiber.New()
+ three := fiber.New()
+
+ two.Mount("/three", three)
+ one.Mount("/two", two)
+ app.Mount("/one", one)
+
+ one.MountPath() // "/one"
+ two.MountPath() // "/one/two"
+ three.MountPath() // "/one/two/three"
+ app.MountPath() // ""
+}
+```
+
+:::caution
+Mounting order is important for MountPath. If you want to get mount paths properly, you should start mounting from the deepest app.
+:::
+
+## Group
+
+You can group routes by creating a `*Group` struct.
+
+```go title="Signature"
+func (app *App) Group(prefix string, handlers ...Handler) Router
+```
+
+```go title="Examples"
+func main() {
+ app := fiber.New()
+
+ api := app.Group("/api", handler) // /api
+
+ v1 := api.Group("/v1", handler) // /api/v1
+ v1.Get("/list", handler) // /api/v1/list
+ v1.Get("/user", handler) // /api/v1/user
+
+ v2 := api.Group("/v2", handler) // /api/v2
+ v2.Get("/list", handler) // /api/v2/list
+ v2.Get("/user", handler) // /api/v2/user
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+## Route
+
+You can define routes with a common prefix inside the common function.
+
+```go title="Signature"
+func (app *App) Route(prefix string, fn func(router Router), name ...string) Router
+```
+
+```go title="Examples"
+func main() {
+ app := fiber.New()
+
+ app.Route("/test", func(api fiber.Router) {
+ api.Get("/foo", handler).Name("foo") // /test/foo (name: test.foo)
+ api.Get("/bar", handler).Name("bar") // /test/bar (name: test.bar)
+ }, "test.")
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+## Server
+
+Server returns the underlying [fasthttp server](https://godoc.org/github.com/valyala/fasthttp#Server)
+
+```go title="Signature"
+func (app *App) Server() *fasthttp.Server
+```
+
+```go title="Examples"
+func main() {
+ app := fiber.New()
+
+ app.Server().MaxConnsPerIP = 1
+
+ // ...
+}
+```
+
+## Server Shutdown
+
+Shutdown gracefully shuts down the server without interrupting any active connections. Shutdown works by first closing all open listeners and then waits indefinitely for all connections to return to idle before shutting down.
+
+ShutdownWithTimeout will forcefully close any active connections after the timeout expires.
+
+ShutdownWithContext shuts down the server including by force if the context's deadline is exceeded.
+
+```go
+func (app *App) Shutdown() error
+func (app *App) ShutdownWithTimeout(timeout time.Duration) error
+func (app *App) ShutdownWithContext(ctx context.Context) error
+```
+
+## HandlersCount
+
+This method returns the amount of registered handlers.
+
+```go title="Signature"
+func (app *App) HandlersCount() uint32
+```
+
+## Stack
+
+This method returns the original router stack
+
+```go title="Signature"
+func (app *App) Stack() [][]*Route
+```
+
+```go title="Examples"
+var handler = func(c *fiber.Ctx) error { return nil }
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/john/:age", handler)
+ app.Post("/register", handler)
+
+ data, _ := json.MarshalIndent(app.Stack(), "", " ")
+ fmt.Println(string(data))
+
+ app.Listen(":3000")
+}
+```
+
+```javascript title="Result"
+[
+ [
+ {
+ "method": "GET",
+ "path": "/john/:age",
+ "params": [
+ "age"
+ ]
+ }
+ ],
+ [
+ {
+ "method": "HEAD",
+ "path": "/john/:age",
+ "params": [
+ "age"
+ ]
+ }
+ ],
+ [
+ {
+ "method": "POST",
+ "path": "/register",
+ "params": null
+ }
+ ]
+]
+```
+
+## Name
+
+This method assigns the name of latest created route.
+
+```go title="Signature"
+func (app *App) Name(name string) Router
+```
+
+```go title="Examples"
+var handler = func(c *fiber.Ctx) error { return nil }
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", handler)
+ app.Name("index")
+
+ app.Get("/doe", handler).Name("home")
+
+ app.Trace("/tracer", handler).Name("tracert")
+
+ app.Delete("/delete", handler).Name("delete")
+
+ a := app.Group("/a")
+ a.Name("fd.")
+
+ a.Get("/test", handler).Name("test")
+
+ data, _ := json.MarshalIndent(app.Stack(), "", " ")
+ fmt.Print(string(data))
+
+ app.Listen(":3000")
+
+}
+```
+
+```javascript title="Result"
+[
+ [
+ {
+ "method": "GET",
+ "name": "index",
+ "path": "/",
+ "params": null
+ },
+ {
+ "method": "GET",
+ "name": "home",
+ "path": "/doe",
+ "params": null
+ },
+ {
+ "method": "GET",
+ "name": "fd.test",
+ "path": "/a/test",
+ "params": null
+ }
+ ],
+ [
+ {
+ "method": "HEAD",
+ "name": "",
+ "path": "/",
+ "params": null
+ },
+ {
+ "method": "HEAD",
+ "name": "",
+ "path": "/doe",
+ "params": null
+ },
+ {
+ "method": "HEAD",
+ "name": "",
+ "path": "/a/test",
+ "params": null
+ }
+ ],
+ null,
+ null,
+ [
+ {
+ "method": "DELETE",
+ "name": "delete",
+ "path": "/delete",
+ "params": null
+ }
+ ],
+ null,
+ null,
+ [
+ {
+ "method": "TRACE",
+ "name": "tracert",
+ "path": "/tracer",
+ "params": null
+ }
+ ],
+ null
+]
+```
+
+## GetRoute
+
+This method gets the route by name.
+
+```go title="Signature"
+func (app *App) GetRoute(name string) Route
+```
+
+```go title="Examples"
+var handler = func(c *fiber.Ctx) error { return nil }
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", handler).Name("index")
+
+ data, _ := json.MarshalIndent(app.GetRoute("index"), "", " ")
+ fmt.Print(string(data))
+
+
+ app.Listen(":3000")
+
+}
+```
+
+```javascript title="Result"
+{
+ "method": "GET",
+ "name": "index",
+ "path": "/",
+ "params": null
+}
+```
+
+## GetRoutes
+
+This method gets all routes.
+
+```go title="Signature"
+func (app *App) GetRoutes(filterUseOption ...bool) []Route
+```
+
+When filterUseOption equal to true, it will filter the routes registered by the middleware.
+```go title="Examples"
+func main() {
+ app := fiber.New()
+ app.Post("/", func (c *fiber.Ctx) error {
+ return c.SendString("Hello, World!")
+ }).Name("index")
+ data, _ := json.MarshalIndent(app.GetRoutes(true), "", " ")
+ fmt.Print(string(data))
+}
+```
+
+```javascript title="Result"
+[
+ {
+ "method": "POST",
+ "name": "index",
+ "path": "/",
+ "params": null
+ }
+]
+```
+
+## Config
+
+Config returns the app config as value \( read-only \).
+
+```go title="Signature"
+func (app *App) Config() Config
+```
+
+## Handler
+
+Handler returns the server handler that can be used to serve custom \*fasthttp.RequestCtx requests.
+
+```go title="Signature"
+func (app *App) Handler() fasthttp.RequestHandler
+```
+
+## Listen
+
+Listen serves HTTP requests from the given address.
+
+```go title="Signature"
+func (app *App) Listen(addr string) error
+```
+
+```go title="Examples"
+// Listen on port :8080
+app.Listen(":8080")
+
+// Custom host
+app.Listen("127.0.0.1:8080")
+```
+
+## ListenTLS
+
+ListenTLS serves HTTPs requests from the given address using certFile and keyFile paths to as TLS certificate and key file.
+
+```go title="Signature"
+func (app *App) ListenTLS(addr, certFile, keyFile string) error
+```
+
+```go title="Examples"
+app.ListenTLS(":443", "./cert.pem", "./cert.key");
+```
+
+Using `ListenTLS` defaults to the following config \( use `Listener` to provide your own config \)
+
+```go title="Default \*tls.Config"
+&tls.Config{
+ MinVersion: tls.VersionTLS12,
+ Certificates: []tls.Certificate{
+ cert,
+ },
+}
+```
+
+## ListenTLSWithCertificate
+
+```go title="Signature"
+func (app *App) ListenTLS(addr string, cert tls.Certificate) error
+```
+
+```go title="Examples"
+app.ListenTLSWithCertificate(":443", cert);
+```
+
+Using `ListenTLSWithCertificate` defaults to the following config \( use `Listener` to provide your own config \)
+
+```go title="Default \*tls.Config"
+&tls.Config{
+ MinVersion: tls.VersionTLS12,
+ Certificates: []tls.Certificate{
+ cert,
+ },
+}
+```
+
+## ListenMutualTLS
+
+ListenMutualTLS serves HTTPs requests from the given address using certFile, keyFile and clientCertFile are the paths to TLS certificate and key file
+
+```go title="Signature"
+func (app *App) ListenMutualTLS(addr, certFile, keyFile, clientCertFile string) error
+```
+
+```go title="Examples"
+app.ListenMutualTLS(":443", "./cert.pem", "./cert.key", "./ca-chain-cert.pem");
+```
+
+Using `ListenMutualTLS` defaults to the following config \( use `Listener` to provide your own config \)
+
+```go title="Default \*tls.Config"
+&tls.Config{
+ MinVersion: tls.VersionTLS12,
+ ClientAuth: tls.RequireAndVerifyClientCert,
+ ClientCAs: clientCertPool,
+ Certificates: []tls.Certificate{
+ cert,
+ },
+}
+```
+
+## ListenMutualTLSWithCertificate
+
+ListenMutualTLSWithCertificate serves HTTPs requests from the given address using certFile, keyFile and clientCertFile are the paths to TLS certificate and key file
+
+```go title="Signature"
+func (app *App) ListenMutualTLSWithCertificate(addr string, cert tls.Certificate, clientCertPool *x509.CertPool) error
+```
+
+```go title="Examples"
+app.ListenMutualTLSWithCertificate(":443", cert, clientCertPool);
+```
+
+Using `ListenMutualTLSWithCertificate` defaults to the following config \( use `Listener` to provide your own config \)
+
+```go title="Default \*tls.Config"
+&tls.Config{
+ MinVersion: tls.VersionTLS12,
+ ClientAuth: tls.RequireAndVerifyClientCert,
+ ClientCAs: clientCertPool,
+ Certificates: []tls.Certificate{
+ cert,
+ },
+}
+```
+
+## Listener
+
+You can pass your own [`net.Listener`](https://pkg.go.dev/net/#Listener) using the `Listener` method. This method can be used to enable **TLS/HTTPS** with a custom tls.Config.
+
+```go title="Signature"
+func (app *App) Listener(ln net.Listener) error
+```
+
+```go title="Examples"
+ln, _ := net.Listen("tcp", ":3000")
+
+cer, _:= tls.LoadX509KeyPair("server.crt", "server.key")
+
+ln = tls.NewListener(ln, &tls.Config{Certificates: []tls.Certificate{cer}})
+
+app.Listener(ln)
+```
+
+## Test
+
+Testing your application is done with the **Test** method. Use this method for creating `_test.go` files or when you need to debug your routing logic. The default timeout is `1s` if you want to disable a timeout altogether, pass `-1` as a second argument.
+
+```go title="Signature"
+func (app *App) Test(req *http.Request, msTimeout ...int) (*http.Response, error)
+```
+
+```go title="Examples"
+// Create route with GET method for test:
+app.Get("/", func(c *fiber.Ctx) error {
+ fmt.Println(c.BaseURL()) // => http://google.com
+ fmt.Println(c.Get("X-Custom-Header")) // => hi
+
+ return c.SendString("hello, World!")
+})
+
+// http.Request
+req := httptest.NewRequest("GET", "http://google.com", nil)
+req.Header.Set("X-Custom-Header", "hi")
+
+// http.Response
+resp, _ := app.Test(req)
+
+// Do something with results:
+if resp.StatusCode == fiber.StatusOK {
+ body, _ := io.ReadAll(resp.Body)
+ fmt.Println(string(body)) // => Hello, World!
+}
+```
+
+## Hooks
+
+Hooks is a method to return [hooks](../guide/hooks.md) property.
+
+```go title="Signature"
+func (app *App) Hooks() *Hooks
+```
\ No newline at end of file
diff --git a/docs/api/client.md b/docs/api/client.md
new file mode 100644
index 0000000..4b52d72
--- /dev/null
+++ b/docs/api/client.md
@@ -0,0 +1,663 @@
+---
+id: client
+title: 🌎 Client
+description: The Client struct represents the Fiber HTTP Client.
+sidebar_position: 5
+---
+
+## Start request
+
+Start a http request with http method and url.
+
+```go title="Signatures"
+// Client http methods
+func (c *Client) Get(url string) *Agent
+func (c *Client) Head(url string) *Agent
+func (c *Client) Post(url string) *Agent
+func (c *Client) Put(url string) *Agent
+func (c *Client) Patch(url string) *Agent
+func (c *Client) Delete(url string) *Agent
+```
+
+Here we present a brief example demonstrating the simulation of a proxy using our `*fiber.Agent` methods.
+```go
+// Get something
+func getSomething(c *fiber.Ctx) (err error) {
+ agent := fiber.Get("")
+ statusCode, body, errs := agent.Bytes()
+ if len(errs) > 0 {
+ return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
+ "errs": errs,
+ })
+ }
+
+ var something fiber.Map
+ err = json.Unmarshal(body, &something)
+ if err != nil {
+ return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
+ "err": err,
+ })
+ }
+
+ return c.Status(statusCode).JSON(something)
+}
+
+// Post something
+func createSomething(c *fiber.Ctx) (err error) {
+ agent := fiber.Post("")
+ agent.Body(c.Body()) // set body received by request
+ statusCode, body, errs := agent.Bytes()
+ if len(errs) > 0 {
+ return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
+ "errs": errs,
+ })
+ }
+
+ // pass status code and body received by the proxy
+ return c.Status(statusCode).Send(body)
+}
+```
+Based on this short example, we can perceive that using the `*fiber.Client` is very straightforward and intuitive.
+
+
+## ✨ Agent
+`Agent` is built on top of FastHTTP's [`HostClient`](https://github.com/valyala/fasthttp/blob/master/client.go#L603) which has lots of convenient helper methods such as dedicated methods for request methods.
+
+### Parse
+
+Parse initializes a HostClient.
+
+```go title="Parse"
+a := AcquireAgent()
+req := a.Request()
+req.Header.SetMethod(MethodGet)
+req.SetRequestURI("http://example.com")
+
+if err := a.Parse(); err != nil {
+ panic(err)
+}
+
+code, body, errs := a.Bytes() // ...
+```
+
+### Set
+
+Set sets the given `key: value` header.
+
+```go title="Signature"
+func (a *Agent) Set(k, v string) *Agent
+func (a *Agent) SetBytesK(k []byte, v string) *Agent
+func (a *Agent) SetBytesV(k string, v []byte) *Agent
+func (a *Agent) SetBytesKV(k []byte, v []byte) *Agent
+```
+
+```go title="Example"
+agent.Set("k1", "v1").
+ SetBytesK([]byte("k1"), "v1").
+ SetBytesV("k1", []byte("v1")).
+ SetBytesKV([]byte("k2"), []byte("v2"))
+// ...
+```
+
+### Add
+
+Add adds the given `key: value` header. Multiple headers with the same key may be added with this function.
+
+```go title="Signature"
+func (a *Agent) Add(k, v string) *Agent
+func (a *Agent) AddBytesK(k []byte, v string) *Agent
+func (a *Agent) AddBytesV(k string, v []byte) *Agent
+func (a *Agent) AddBytesKV(k []byte, v []byte) *Agent
+```
+
+```go title="Example"
+agent.Add("k1", "v1").
+ AddBytesK([]byte("k1"), "v1").
+ AddBytesV("k1", []byte("v1")).
+ AddBytesKV([]byte("k2"), []byte("v2"))
+// Headers:
+// K1: v1
+// K1: v1
+// K1: v1
+// K2: v2
+```
+
+### ConnectionClose
+
+ConnectionClose adds the `Connection: close` header.
+
+```go title="Signature"
+func (a *Agent) ConnectionClose() *Agent
+```
+
+```go title="Example"
+agent.ConnectionClose()
+// ...
+```
+
+### UserAgent
+
+UserAgent sets `User-Agent` header value.
+
+```go title="Signature"
+func (a *Agent) UserAgent(userAgent string) *Agent
+func (a *Agent) UserAgentBytes(userAgent []byte) *Agent
+```
+
+```go title="Example"
+agent.UserAgent("fiber")
+// ...
+```
+
+### Cookie
+
+Cookie sets a cookie in `key: value` form. `Cookies` can be used to set multiple cookies.
+
+```go title="Signature"
+func (a *Agent) Cookie(key, value string) *Agent
+func (a *Agent) CookieBytesK(key []byte, value string) *Agent
+func (a *Agent) CookieBytesKV(key, value []byte) *Agent
+func (a *Agent) Cookies(kv ...string) *Agent
+func (a *Agent) CookiesBytesKV(kv ...[]byte) *Agent
+```
+
+```go title="Example"
+agent.Cookie("k", "v")
+agent.Cookies("k1", "v1", "k2", "v2")
+// ...
+```
+
+### Referer
+
+Referer sets the Referer header value.
+
+```go title="Signature"
+func (a *Agent) Referer(referer string) *Agent
+func (a *Agent) RefererBytes(referer []byte) *Agent
+```
+
+```go title="Example"
+agent.Referer("https://docs.gofiber.io")
+// ...
+```
+
+### ContentType
+
+ContentType sets Content-Type header value.
+
+```go title="Signature"
+func (a *Agent) ContentType(contentType string) *Agent
+func (a *Agent) ContentTypeBytes(contentType []byte) *Agent
+```
+
+```go title="Example"
+agent.ContentType("custom-type")
+// ...
+```
+
+### Host
+
+Host sets the Host header.
+
+```go title="Signature"
+func (a *Agent) Host(host string) *Agent
+func (a *Agent) HostBytes(host []byte) *Agent
+```
+
+```go title="Example"
+agent.Host("example.com")
+// ...
+```
+
+### QueryString
+
+QueryString sets the URI query string.
+
+```go title="Signature"
+func (a *Agent) QueryString(queryString string) *Agent
+func (a *Agent) QueryStringBytes(queryString []byte) *Agent
+```
+
+```go title="Example"
+agent.QueryString("foo=bar")
+// ...
+```
+
+### BasicAuth
+
+BasicAuth sets the URI username and password using HTTP Basic Auth.
+
+```go title="Signature"
+func (a *Agent) BasicAuth(username, password string) *Agent
+func (a *Agent) BasicAuthBytes(username, password []byte) *Agent
+```
+
+```go title="Example"
+agent.BasicAuth("foo", "bar")
+// ...
+```
+
+### Body
+
+There are several ways to set request body.
+
+```go title="Signature"
+func (a *Agent) BodyString(bodyString string) *Agent
+func (a *Agent) Body(body []byte) *Agent
+
+// BodyStream sets request body stream and, optionally body size.
+//
+// If bodySize is >= 0, then the bodyStream must provide exactly bodySize bytes
+// before returning io.EOF.
+//
+// If bodySize < 0, then bodyStream is read until io.EOF.
+//
+// bodyStream.Close() is called after finishing reading all body data
+// if it implements io.Closer.
+//
+// Note that GET and HEAD requests cannot have body.
+func (a *Agent) BodyStream(bodyStream io.Reader, bodySize int) *Agent
+```
+
+```go title="Example"
+agent.BodyString("foo=bar")
+agent.Body([]byte("bar=baz"))
+agent.BodyStream(strings.NewReader("body=stream"), -1)
+// ...
+```
+
+### JSON
+
+JSON sends a JSON request by setting the Content-Type header to the `ctype` parameter. If no `ctype` is passed in, the header is set to `application/json`.
+
+```go title="Signature"
+func (a *Agent) JSON(v interface{}, ctype ...string) *Agent
+```
+
+```go title="Example"
+agent.JSON(fiber.Map{"success": true})
+// ...
+```
+
+### XML
+
+XML sends an XML request by setting the Content-Type header to `application/xml`.
+
+```go title="Signature"
+func (a *Agent) XML(v interface{}) *Agent
+```
+
+```go title="Example"
+agent.XML(fiber.Map{"success": true})
+// ...
+```
+
+### Form
+
+Form sends a form request by setting the Content-Type header to `application/x-www-form-urlencoded`.
+
+```go title="Signature"
+// Form sends form request with body if args is non-nil.
+//
+// It is recommended obtaining args via AcquireArgs and release it
+// manually in performance-critical code.
+func (a *Agent) Form(args *Args) *Agent
+```
+
+```go title="Example"
+args := AcquireArgs()
+args.Set("foo", "bar")
+
+agent.Form(args)
+// ...
+ReleaseArgs(args)
+```
+
+### MultipartForm
+
+MultipartForm sends multipart form request by setting the Content-Type header to `multipart/form-data`. These requests can include key-value's and files.
+
+```go title="Signature"
+// MultipartForm sends multipart form request with k-v and files.
+//
+// It is recommended to obtain args via AcquireArgs and release it
+// manually in performance-critical code.
+func (a *Agent) MultipartForm(args *Args) *Agent
+```
+
+```go title="Example"
+args := AcquireArgs()
+args.Set("foo", "bar")
+
+agent.MultipartForm(args)
+// ...
+ReleaseArgs(args)
+```
+
+Fiber provides several methods for sending files. Note that they must be called before `MultipartForm`.
+
+#### Boundary
+
+Boundary sets boundary for multipart form request.
+
+```go title="Signature"
+func (a *Agent) Boundary(boundary string) *Agent
+```
+
+```go title="Example"
+agent.Boundary("myBoundary")
+ .MultipartForm(nil)
+// ...
+```
+
+#### SendFile\(s\)
+
+SendFile read a file and appends it to a multipart form request. Sendfiles can be used to append multiple files.
+
+```go title="Signature"
+func (a *Agent) SendFile(filename string, fieldname ...string) *Agent
+func (a *Agent) SendFiles(filenamesAndFieldnames ...string) *Agent
+```
+
+```go title="Example"
+agent.SendFile("f", "field name")
+ .SendFiles("f1", "field name1", "f2").
+ .MultipartForm(nil)
+// ...
+```
+
+#### FileData
+
+FileData appends file data for multipart form request.
+
+```go
+// FormFile represents multipart form file
+type FormFile struct {
+ // Fieldname is form file's field name
+ Fieldname string
+ // Name is form file's name
+ Name string
+ // Content is form file's content
+ Content []byte
+}
+```
+
+```go title="Signature"
+// FileData appends files for multipart form request.
+//
+// It is recommended obtaining formFile via AcquireFormFile and release it
+// manually in performance-critical code.
+func (a *Agent) FileData(formFiles ...*FormFile) *Agent
+```
+
+```go title="Example"
+ff1 := &FormFile{"filename1", "field name1", []byte("content")}
+ff2 := &FormFile{"filename2", "field name2", []byte("content")}
+agent.FileData(ff1, ff2).
+ MultipartForm(nil)
+// ...
+```
+
+### Debug
+
+Debug mode enables logging request and response detail to `io.writer`\(default is `os.Stdout`\).
+
+```go title="Signature"
+func (a *Agent) Debug(w ...io.Writer) *Agent
+```
+
+```go title="Example"
+agent.Debug()
+// ...
+```
+
+### Timeout
+
+Timeout sets request timeout duration.
+
+```go title="Signature"
+func (a *Agent) Timeout(timeout time.Duration) *Agent
+```
+
+```go title="Example"
+agent.Timeout(time.Second)
+// ...
+```
+
+### Reuse
+
+Reuse enables the Agent instance to be used again after one request. If agent is reusable, then it should be released manually when it is no longer used.
+
+```go title="Signature"
+func (a *Agent) Reuse() *Agent
+```
+
+```go title="Example"
+agent.Reuse()
+// ...
+```
+
+### InsecureSkipVerify
+
+InsecureSkipVerify controls whether the Agent verifies the server certificate chain and host name.
+
+```go title="Signature"
+func (a *Agent) InsecureSkipVerify() *Agent
+```
+
+```go title="Example"
+agent.InsecureSkipVerify()
+// ...
+```
+
+### TLSConfig
+
+TLSConfig sets tls config.
+
+```go title="Signature"
+func (a *Agent) TLSConfig(config *tls.Config) *Agent
+```
+
+```go title="Example"
+// Create tls certificate
+cer, _ := tls.LoadX509KeyPair("pem", "key")
+
+config := &tls.Config{
+ Certificates: []tls.Certificate{cer},
+}
+
+agent.TLSConfig(config)
+// ...
+```
+
+### MaxRedirectsCount
+
+MaxRedirectsCount sets max redirect count for GET and HEAD.
+
+```go title="Signature"
+func (a *Agent) MaxRedirectsCount(count int) *Agent
+```
+
+```go title="Example"
+agent.MaxRedirectsCount(7)
+// ...
+```
+
+### JSONEncoder
+
+JSONEncoder sets custom json encoder.
+
+```go title="Signature"
+func (a *Agent) JSONEncoder(jsonEncoder utils.JSONMarshal) *Agent
+```
+
+```go title="Example"
+agent.JSONEncoder(json.Marshal)
+// ...
+```
+
+### JSONDecoder
+
+JSONDecoder sets custom json decoder.
+
+```go title="Signature"
+func (a *Agent) JSONDecoder(jsonDecoder utils.JSONUnmarshal) *Agent
+```
+
+```go title="Example"
+agent.JSONDecoder(json.Unmarshal)
+// ...
+```
+
+### Request
+
+Request returns Agent request instance.
+
+```go title="Signature"
+func (a *Agent) Request() *Request
+```
+
+```go title="Example"
+req := agent.Request()
+// ...
+```
+
+### SetResponse
+
+SetResponse sets custom response for the Agent instance. It is recommended obtaining custom response via AcquireResponse and release it manually in performance-critical code.
+
+```go title="Signature"
+func (a *Agent) SetResponse(customResp *Response) *Agent
+```
+
+```go title="Example"
+resp := AcquireResponse()
+agent.SetResponse(resp)
+// ...
+ReleaseResponse(resp)
+```
+
+
+Example handling for response values
+
+```go title="Example handling response"
+// Create a Fiber HTTP client agent
+agent := fiber.Get("https://httpbin.org/get")
+
+// Acquire a response object to store the result
+resp := fiber.AcquireResponse()
+agent.SetResponse(resp)
+
+// Perform the HTTP GET request
+code, body, errs := agent.String()
+if errs != nil {
+ // Handle any errors that occur during the request
+ panic(errs)
+}
+
+// Print the HTTP response code and body
+fmt.Println("Response Code:", code)
+fmt.Println("Response Body:", body)
+
+// Visit and print all the headers in the response
+resp.Header.VisitAll(func(key, value []byte) {
+ fmt.Println("Header", string(key), "value", string(value))
+})
+
+// Release the response to free up resources
+fiber.ReleaseResponse(resp)
+```
+
+Output:
+```txt title="Output"
+Response Code: 200
+Response Body: {
+ "args": {},
+ "headers": {
+ "Host": "httpbin.org",
+ "User-Agent": "fiber",
+ "X-Amzn-Trace-Id": "Root=1-653763d0-2555d5ba3838f1e9092f9f72"
+ },
+ "origin": "83.137.191.1",
+ "url": "https://httpbin.org/get"
+}
+
+Header Content-Length value 226
+Header Content-Type value application/json
+Header Server value gunicorn/19.9.0
+Header Date value Tue, 24 Oct 2023 06:27:28 GMT
+Header Connection value keep-alive
+Header Access-Control-Allow-Origin value *
+Header Access-Control-Allow-Credentials value true
+```
+
+
+
+### Dest
+
+Dest sets custom dest. The contents of dest will be replaced by the response body, if the dest is too small a new slice will be allocated.
+
+```go title="Signature"
+func (a *Agent) Dest(dest []byte) *Agent {
+```
+
+```go title="Example"
+agent.Dest(nil)
+// ...
+```
+
+### Bytes
+
+Bytes returns the status code, bytes body and errors of url.
+
+```go title="Signature"
+func (a *Agent) Bytes() (code int, body []byte, errs []error)
+```
+
+```go title="Example"
+code, body, errs := agent.Bytes()
+// ...
+```
+
+### String
+
+String returns the status code, string body and errors of url.
+
+```go title="Signature"
+func (a *Agent) String() (int, string, []error)
+```
+
+```go title="Example"
+code, body, errs := agent.String()
+// ...
+```
+
+### Struct
+
+Struct returns the status code, bytes body and errors of url. And bytes body will be unmarshalled to given v.
+
+```go title="Signature"
+func (a *Agent) Struct(v interface{}) (code int, body []byte, errs []error)
+```
+
+```go title="Example"
+var d data
+code, body, errs := agent.Struct(&d)
+// ...
+```
+
+### RetryIf
+
+RetryIf controls whether a retry should be attempted after an error.
+By default, will use isIdempotent function from fasthttp
+
+```go title="Signature"
+func (a *Agent) RetryIf(retryIf RetryIfFunc) *Agent
+```
+
+```go title="Example"
+agent.Get("https://example.com").RetryIf(func (req *fiber.Request) bool {
+ return req.URI() == "https://example.com"
+})
+// ...
+```
diff --git a/docs/api/constants.md b/docs/api/constants.md
new file mode 100644
index 0000000..8a436a9
--- /dev/null
+++ b/docs/api/constants.md
@@ -0,0 +1,291 @@
+---
+id: constants
+title: 📋 Constants
+description: Some constants for Fiber.
+sidebar_position: 4
+---
+
+HTTP methods were copied from net/http.
+
+```go
+const (
+ MethodGet = "GET" // RFC 7231, 4.3.1
+ MethodHead = "HEAD" // RFC 7231, 4.3.2
+ MethodPost = "POST" // RFC 7231, 4.3.3
+ MethodPut = "PUT" // RFC 7231, 4.3.4
+ MethodPatch = "PATCH" // RFC 5789
+ MethodDelete = "DELETE" // RFC 7231, 4.3.5
+ MethodConnect = "CONNECT" // RFC 7231, 4.3.6
+ MethodOptions = "OPTIONS" // RFC 7231, 4.3.7
+ MethodTrace = "TRACE" // RFC 7231, 4.3.8
+ methodUse = "USE"
+)
+```
+
+MIME types that are commonly used
+
+```go
+const (
+ MIMETextXML = "text/xml"
+ MIMETextHTML = "text/html"
+ MIMETextPlain = "text/plain"
+ MIMEApplicationXML = "application/xml"
+ MIMEApplicationJSON = "application/json"
+ MIMEApplicationJavaScript = "application/javascript"
+ MIMEApplicationForm = "application/x-www-form-urlencoded"
+ MIMEOctetStream = "application/octet-stream"
+ MIMEMultipartForm = "multipart/form-data"
+
+ MIMETextXMLCharsetUTF8 = "text/xml; charset=utf-8"
+ MIMETextHTMLCharsetUTF8 = "text/html; charset=utf-8"
+ MIMETextPlainCharsetUTF8 = "text/plain; charset=utf-8"
+ MIMEApplicationXMLCharsetUTF8 = "application/xml; charset=utf-8"
+ MIMEApplicationJSONCharsetUTF8 = "application/json; charset=utf-8"
+ MIMEApplicationJavaScriptCharsetUTF8 = "application/javascript; charset=utf-8"
+)
+```
+
+HTTP status codes were copied from net/http.
+
+```go
+const (
+ StatusContinue = 100 // RFC 7231, 6.2.1
+ StatusSwitchingProtocols = 101 // RFC 7231, 6.2.2
+ StatusProcessing = 102 // RFC 2518, 10.1
+ StatusEarlyHints = 103 // RFC 8297
+ StatusOK = 200 // RFC 7231, 6.3.1
+ StatusCreated = 201 // RFC 7231, 6.3.2
+ StatusAccepted = 202 // RFC 7231, 6.3.3
+ StatusNonAuthoritativeInformation = 203 // RFC 7231, 6.3.4
+ StatusNoContent = 204 // RFC 7231, 6.3.5
+ StatusResetContent = 205 // RFC 7231, 6.3.6
+ StatusPartialContent = 206 // RFC 7233, 4.1
+ StatusMultiStatus = 207 // RFC 4918, 11.1
+ StatusAlreadyReported = 208 // RFC 5842, 7.1
+ StatusIMUsed = 226 // RFC 3229, 10.4.1
+ StatusMultipleChoices = 300 // RFC 7231, 6.4.1
+ StatusMovedPermanently = 301 // RFC 7231, 6.4.2
+ StatusFound = 302 // RFC 7231, 6.4.3
+ StatusSeeOther = 303 // RFC 7231, 6.4.4
+ StatusNotModified = 304 // RFC 7232, 4.1
+ StatusUseProxy = 305 // RFC 7231, 6.4.5
+ StatusTemporaryRedirect = 307 // RFC 7231, 6.4.7
+ StatusPermanentRedirect = 308 // RFC 7538, 3
+ StatusBadRequest = 400 // RFC 7231, 6.5.1
+ StatusUnauthorized = 401 // RFC 7235, 3.1
+ StatusPaymentRequired = 402 // RFC 7231, 6.5.2
+ StatusForbidden = 403 // RFC 7231, 6.5.3
+ StatusNotFound = 404 // RFC 7231, 6.5.4
+ StatusMethodNotAllowed = 405 // RFC 7231, 6.5.5
+ StatusNotAcceptable = 406 // RFC 7231, 6.5.6
+ StatusProxyAuthRequired = 407 // RFC 7235, 3.2
+ StatusRequestTimeout = 408 // RFC 7231, 6.5.7
+ StatusConflict = 409 // RFC 7231, 6.5.8
+ StatusGone = 410 // RFC 7231, 6.5.9
+ StatusLengthRequired = 411 // RFC 7231, 6.5.10
+ StatusPreconditionFailed = 412 // RFC 7232, 4.2
+ StatusRequestEntityTooLarge = 413 // RFC 7231, 6.5.11
+ StatusRequestURITooLong = 414 // RFC 7231, 6.5.12
+ StatusUnsupportedMediaType = 415 // RFC 7231, 6.5.13
+ StatusRequestedRangeNotSatisfiable = 416 // RFC 7233, 4.4
+ StatusExpectationFailed = 417 // RFC 7231, 6.5.14
+ StatusTeapot = 418 // RFC 7168, 2.3.3
+ StatusMisdirectedRequest = 421 // RFC 7540, 9.1.2
+ StatusUnprocessableEntity = 422 // RFC 4918, 11.2
+ StatusLocked = 423 // RFC 4918, 11.3
+ StatusFailedDependency = 424 // RFC 4918, 11.4
+ StatusTooEarly = 425 // RFC 8470, 5.2.
+ StatusUpgradeRequired = 426 // RFC 7231, 6.5.15
+ StatusPreconditionRequired = 428 // RFC 6585, 3
+ StatusTooManyRequests = 429 // RFC 6585, 4
+ StatusRequestHeaderFieldsTooLarge = 431 // RFC 6585, 5
+ StatusUnavailableForLegalReasons = 451 // RFC 7725, 3
+ StatusInternalServerError = 500 // RFC 7231, 6.6.1
+ StatusNotImplemented = 501 // RFC 7231, 6.6.2
+ StatusBadGateway = 502 // RFC 7231, 6.6.3
+ StatusServiceUnavailable = 503 // RFC 7231, 6.6.4
+ StatusGatewayTimeout = 504 // RFC 7231, 6.6.5
+ StatusHTTPVersionNotSupported = 505 // RFC 7231, 6.6.6
+ StatusVariantAlsoNegotiates = 506 // RFC 2295, 8.1
+ StatusInsufficientStorage = 507 // RFC 4918, 11.5
+ StatusLoopDetected = 508 // RFC 5842, 7.2
+ StatusNotExtended = 510 // RFC 2774, 7
+ StatusNetworkAuthenticationRequired = 511 // RFC 6585, 6
+)
+```
+
+Errors
+
+```go
+var (
+ ErrBadRequest = NewError(StatusBadRequest) // RFC 7231, 6.5.1
+ ErrUnauthorized = NewError(StatusUnauthorized) // RFC 7235, 3.1
+ ErrPaymentRequired = NewError(StatusPaymentRequired) // RFC 7231, 6.5.2
+ ErrForbidden = NewError(StatusForbidden) // RFC 7231, 6.5.3
+ ErrNotFound = NewError(StatusNotFound) // RFC 7231, 6.5.4
+ ErrMethodNotAllowed = NewError(StatusMethodNotAllowed) // RFC 7231, 6.5.5
+ ErrNotAcceptable = NewError(StatusNotAcceptable) // RFC 7231, 6.5.6
+ ErrProxyAuthRequired = NewError(StatusProxyAuthRequired) // RFC 7235, 3.2
+ ErrRequestTimeout = NewError(StatusRequestTimeout) // RFC 7231, 6.5.7
+ ErrConflict = NewError(StatusConflict) // RFC 7231, 6.5.8
+ ErrGone = NewError(StatusGone) // RFC 7231, 6.5.9
+ ErrLengthRequired = NewError(StatusLengthRequired) // RFC 7231, 6.5.10
+ ErrPreconditionFailed = NewError(StatusPreconditionFailed) // RFC 7232, 4.2
+ ErrRequestEntityTooLarge = NewError(StatusRequestEntityTooLarge) // RFC 7231, 6.5.11
+ ErrRequestURITooLong = NewError(StatusRequestURITooLong) // RFC 7231, 6.5.12
+ ErrUnsupportedMediaType = NewError(StatusUnsupportedMediaType) // RFC 7231, 6.5.13
+ ErrRequestedRangeNotSatisfiable = NewError(StatusRequestedRangeNotSatisfiable) // RFC 7233, 4.4
+ ErrExpectationFailed = NewError(StatusExpectationFailed) // RFC 7231, 6.5.14
+ ErrTeapot = NewError(StatusTeapot) // RFC 7168, 2.3.3
+ ErrMisdirectedRequest = NewError(StatusMisdirectedRequest) // RFC 7540, 9.1.2
+ ErrUnprocessableEntity = NewError(StatusUnprocessableEntity) // RFC 4918, 11.2
+ ErrLocked = NewError(StatusLocked) // RFC 4918, 11.3
+ ErrFailedDependency = NewError(StatusFailedDependency) // RFC 4918, 11.4
+ ErrTooEarly = NewError(StatusTooEarly) // RFC 8470, 5.2.
+ ErrUpgradeRequired = NewError(StatusUpgradeRequired) // RFC 7231, 6.5.15
+ ErrPreconditionRequired = NewError(StatusPreconditionRequired) // RFC 6585, 3
+ ErrTooManyRequests = NewError(StatusTooManyRequests) // RFC 6585, 4
+ ErrRequestHeaderFieldsTooLarge = NewError(StatusRequestHeaderFieldsTooLarge) // RFC 6585, 5
+ ErrUnavailableForLegalReasons = NewError(StatusUnavailableForLegalReasons) // RFC 7725, 3
+ ErrInternalServerError = NewError(StatusInternalServerError) // RFC 7231, 6.6.1
+ ErrNotImplemented = NewError(StatusNotImplemented) // RFC 7231, 6.6.2
+ ErrBadGateway = NewError(StatusBadGateway) // RFC 7231, 6.6.3
+ ErrServiceUnavailable = NewError(StatusServiceUnavailable) // RFC 7231, 6.6.4
+ ErrGatewayTimeout = NewError(StatusGatewayTimeout) // RFC 7231, 6.6.5
+ ErrHTTPVersionNotSupported = NewError(StatusHTTPVersionNotSupported) // RFC 7231, 6.6.6
+ ErrVariantAlsoNegotiates = NewError(StatusVariantAlsoNegotiates) // RFC 2295, 8.1
+ ErrInsufficientStorage = NewError(StatusInsufficientStorage) // RFC 4918, 11.5
+ ErrLoopDetected = NewError(StatusLoopDetected) // RFC 5842, 7.2
+ ErrNotExtended = NewError(StatusNotExtended) // RFC 2774, 7
+ ErrNetworkAuthenticationRequired = NewError(StatusNetworkAuthenticationRequired) // RFC 6585, 6
+)
+```
+
+HTTP Headers were copied from net/http.
+
+```go
+const (
+ HeaderAuthorization = "Authorization"
+ HeaderProxyAuthenticate = "Proxy-Authenticate"
+ HeaderProxyAuthorization = "Proxy-Authorization"
+ HeaderWWWAuthenticate = "WWW-Authenticate"
+ HeaderAge = "Age"
+ HeaderCacheControl = "Cache-Control"
+ HeaderClearSiteData = "Clear-Site-Data"
+ HeaderExpires = "Expires"
+ HeaderPragma = "Pragma"
+ HeaderWarning = "Warning"
+ HeaderAcceptCH = "Accept-CH"
+ HeaderAcceptCHLifetime = "Accept-CH-Lifetime"
+ HeaderContentDPR = "Content-DPR"
+ HeaderDPR = "DPR"
+ HeaderEarlyData = "Early-Data"
+ HeaderSaveData = "Save-Data"
+ HeaderViewportWidth = "Viewport-Width"
+ HeaderWidth = "Width"
+ HeaderETag = "ETag"
+ HeaderIfMatch = "If-Match"
+ HeaderIfModifiedSince = "If-Modified-Since"
+ HeaderIfNoneMatch = "If-None-Match"
+ HeaderIfUnmodifiedSince = "If-Unmodified-Since"
+ HeaderLastModified = "Last-Modified"
+ HeaderVary = "Vary"
+ HeaderConnection = "Connection"
+ HeaderKeepAlive = "Keep-Alive"
+ HeaderAccept = "Accept"
+ HeaderAcceptCharset = "Accept-Charset"
+ HeaderAcceptEncoding = "Accept-Encoding"
+ HeaderAcceptLanguage = "Accept-Language"
+ HeaderCookie = "Cookie"
+ HeaderExpect = "Expect"
+ HeaderMaxForwards = "Max-Forwards"
+ HeaderSetCookie = "Set-Cookie"
+ HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials"
+ HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers"
+ HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods"
+ HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin"
+ HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers"
+ HeaderAccessControlMaxAge = "Access-Control-Max-Age"
+ HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers"
+ HeaderAccessControlRequestMethod = "Access-Control-Request-Method"
+ HeaderOrigin = "Origin"
+ HeaderTimingAllowOrigin = "Timing-Allow-Origin"
+ HeaderXPermittedCrossDomainPolicies = "X-Permitted-Cross-Domain-Policies"
+ HeaderDNT = "DNT"
+ HeaderTk = "Tk"
+ HeaderContentDisposition = "Content-Disposition"
+ HeaderContentEncoding = "Content-Encoding"
+ HeaderContentLanguage = "Content-Language"
+ HeaderContentLength = "Content-Length"
+ HeaderContentLocation = "Content-Location"
+ HeaderContentType = "Content-Type"
+ HeaderForwarded = "Forwarded"
+ HeaderVia = "Via"
+ HeaderXForwardedFor = "X-Forwarded-For"
+ HeaderXForwardedHost = "X-Forwarded-Host"
+ HeaderXForwardedProto = "X-Forwarded-Proto"
+ HeaderXForwardedProtocol = "X-Forwarded-Protocol"
+ HeaderXForwardedSsl = "X-Forwarded-Ssl"
+ HeaderXUrlScheme = "X-Url-Scheme"
+ HeaderLocation = "Location"
+ HeaderFrom = "From"
+ HeaderHost = "Host"
+ HeaderReferer = "Referer"
+ HeaderReferrerPolicy = "Referrer-Policy"
+ HeaderUserAgent = "User-Agent"
+ HeaderAllow = "Allow"
+ HeaderServer = "Server"
+ HeaderAcceptRanges = "Accept-Ranges"
+ HeaderContentRange = "Content-Range"
+ HeaderIfRange = "If-Range"
+ HeaderRange = "Range"
+ HeaderContentSecurityPolicy = "Content-Security-Policy"
+ HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only"
+ HeaderCrossOriginResourcePolicy = "Cross-Origin-Resource-Policy"
+ HeaderExpectCT = "Expect-CT"
+ HeaderFeaturePolicy = "Feature-Policy"
+ HeaderPublicKeyPins = "Public-Key-Pins"
+ HeaderPublicKeyPinsReportOnly = "Public-Key-Pins-Report-Only"
+ HeaderStrictTransportSecurity = "Strict-Transport-Security"
+ HeaderUpgradeInsecureRequests = "Upgrade-Insecure-Requests"
+ HeaderXContentTypeOptions = "X-Content-Type-Options"
+ HeaderXDownloadOptions = "X-Download-Options"
+ HeaderXFrameOptions = "X-Frame-Options"
+ HeaderXPoweredBy = "X-Powered-By"
+ HeaderXXSSProtection = "X-XSS-Protection"
+ HeaderLastEventID = "Last-Event-ID"
+ HeaderNEL = "NEL"
+ HeaderPingFrom = "Ping-From"
+ HeaderPingTo = "Ping-To"
+ HeaderReportTo = "Report-To"
+ HeaderTE = "TE"
+ HeaderTrailer = "Trailer"
+ HeaderTransferEncoding = "Transfer-Encoding"
+ HeaderSecWebSocketAccept = "Sec-WebSocket-Accept"
+ HeaderSecWebSocketExtensions = "Sec-WebSocket-Extensions"
+ HeaderSecWebSocketKey = "Sec-WebSocket-Key"
+ HeaderSecWebSocketProtocol = "Sec-WebSocket-Protocol"
+ HeaderSecWebSocketVersion = "Sec-WebSocket-Version"
+ HeaderAcceptPatch = "Accept-Patch"
+ HeaderAcceptPushPolicy = "Accept-Push-Policy"
+ HeaderAcceptSignature = "Accept-Signature"
+ HeaderAltSvc = "Alt-Svc"
+ HeaderDate = "Date"
+ HeaderIndex = "Index"
+ HeaderLargeAllocation = "Large-Allocation"
+ HeaderLink = "Link"
+ HeaderPushPolicy = "Push-Policy"
+ HeaderRetryAfter = "Retry-After"
+ HeaderServerTiming = "Server-Timing"
+ HeaderSignature = "Signature"
+ HeaderSignedHeaders = "Signed-Headers"
+ HeaderSourceMap = "SourceMap"
+ HeaderUpgrade = "Upgrade"
+ HeaderXDNSPrefetchControl = "X-DNS-Prefetch-Control"
+ HeaderXPingback = "X-Pingback"
+ HeaderXRequestID = "X-Request-ID"
+ HeaderXRequestedWith = "X-Requested-With"
+ HeaderXRobotsTag = "X-Robots-Tag"
+ HeaderXUACompatible = "X-UA-Compatible"
+)
+```
\ No newline at end of file
diff --git a/docs/api/ctx.md b/docs/api/ctx.md
new file mode 100644
index 0000000..fdb2adc
--- /dev/null
+++ b/docs/api/ctx.md
@@ -0,0 +1,2159 @@
+---
+id: ctx
+title: 🧠 Ctx
+description: >-
+ The Ctx struct represents the Context which hold the HTTP request and
+ response. It has methods for the request query string, parameters, body, HTTP
+ headers, and so on.
+sidebar_position: 3
+---
+
+## Accepts
+
+Checks, if the specified **extensions** or **content** **types** are acceptable.
+
+:::info
+Based on the request’s [Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept) HTTP header.
+:::
+
+```go title="Signature"
+func (c *Ctx) Accepts(offers ...string) string
+func (c *Ctx) AcceptsCharsets(offers ...string) string
+func (c *Ctx) AcceptsEncodings(offers ...string) string
+func (c *Ctx) AcceptsLanguages(offers ...string) string
+```
+
+```go title="Example"
+// Accept: text/html, application/json; q=0.8, text/plain; q=0.5; charset="utf-8"
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Accepts("html") // "html"
+ c.Accepts("text/html") // "text/html"
+ c.Accepts("json", "text") // "json"
+ c.Accepts("application/json") // "application/json"
+ c.Accepts("text/plain", "application/json") // "application/json", due to quality
+ c.Accepts("image/png") // ""
+ c.Accepts("png") // ""
+ // ...
+})
+```
+
+```go title="Example 2"
+// Accept: text/html, text/*, application/json, */*; q=0
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Accepts("text/plain", "application/json") // "application/json", due to specificity
+ c.Accepts("application/json", "text/html") // "text/html", due to first match
+ c.Accepts("image/png") // "", due to */* without q factor 0 is Not Acceptable
+ // ...
+})
+```
+
+Media-Type parameters are supported.
+
+```go title="Example 3"
+// Accept: text/plain, application/json; version=1; foo=bar
+
+app.Get("/", func(c *fiber.Ctx) error {
+ // Extra parameters in the accept are ignored
+ c.Accepts("text/plain;format=flowed") // "text/plain;format=flowed"
+
+ // An offer must contain all parameters present in the Accept type
+ c.Accepts("application/json") // ""
+
+ // Parameter order and capitalization does not matter. Quotes on values are stripped.
+ c.Accepts(`application/json;foo="bar";VERSION=1`) // "application/json;foo="bar";VERSION=1"
+})
+```
+
+```go title="Example 4"
+// Accept: text/plain;format=flowed;q=0.9, text/plain
+// i.e., "I prefer text/plain;format=flowed less than other forms of text/plain"
+app.Get("/", func(c *fiber.Ctx) error {
+ // Beware: the order in which offers are listed matters.
+ // Although the client specified they prefer not to receive format=flowed,
+ // the text/plain Accept matches with "text/plain;format=flowed" first, so it is returned.
+ c.Accepts("text/plain;format=flowed", "text/plain") // "text/plain;format=flowed"
+
+ // Here, things behave as expected:
+ c.Accepts("text/plain", "text/plain;format=flowed") // "text/plain"
+})
+```
+
+Fiber provides similar functions for the other accept headers.
+
+```go
+// Accept-Charset: utf-8, iso-8859-1;q=0.2
+// Accept-Encoding: gzip, compress;q=0.2
+// Accept-Language: en;q=0.8, nl, ru
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.AcceptsCharsets("utf-16", "iso-8859-1")
+ // "iso-8859-1"
+
+ c.AcceptsEncodings("compress", "br")
+ // "compress"
+
+ c.AcceptsLanguages("pt", "nl", "ru")
+ // "nl"
+ // ...
+})
+```
+
+## AllParams
+
+Params is used to get all route parameters.
+Using Params method to get params.
+
+```go title="Signature"
+func (c *Ctx) AllParams() map[string]string
+```
+
+```go title="Example"
+// GET http://example.com/user/fenny
+app.Get("/user/:name", func(c *fiber.Ctx) error {
+ c.AllParams() // "{"name": "fenny"}"
+
+ // ...
+})
+
+// GET http://example.com/user/fenny/123
+app.Get("/user/*", func(c *fiber.Ctx) error {
+ c.AllParams() // "{"*1": "fenny/123"}"
+
+ // ...
+})
+```
+
+## App
+
+Returns the [\*App](ctx.md) reference so you could easily access all application settings.
+
+```go title="Signature"
+func (c *Ctx) App() *App
+```
+
+```go title="Example"
+app.Get("/stack", func(c *fiber.Ctx) error {
+ return c.JSON(c.App().Stack())
+})
+```
+
+## Append
+
+Appends the specified **value** to the HTTP response header field.
+
+:::caution
+If the header is **not** already set, it creates the header with the specified value.
+:::
+
+```go title="Signature"
+func (c *Ctx) Append(field string, values ...string)
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Append("Link", "http://google.com", "http://localhost")
+ // => Link: http://localhost, http://google.com
+
+ c.Append("Link", "Test")
+ // => Link: http://localhost, http://google.com, Test
+
+ // ...
+})
+```
+
+## Attachment
+
+Sets the HTTP response [Content-Disposition](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) header field to `attachment`.
+
+```go title="Signature"
+func (c *Ctx) Attachment(filename ...string)
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Attachment()
+ // => Content-Disposition: attachment
+
+ c.Attachment("./upload/images/logo.png")
+ // => Content-Disposition: attachment; filename="logo.png"
+ // => Content-Type: image/png
+
+ // ...
+})
+```
+
+## BaseURL
+
+Returns the base URL \(**protocol** + **host**\) as a `string`.
+
+```go title="Signature"
+func (c *Ctx) BaseURL() string
+```
+
+```go title="Example"
+// GET https://example.com/page#chapter-1
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.BaseURL() // https://example.com
+ // ...
+})
+```
+
+## Bind
+
+Add vars to default view var map binding to template engine.
+Variables are read by the Render method and may be overwritten.
+
+```go title="Signature"
+func (c *Ctx) Bind(vars Map) error
+```
+
+```go title="Example"
+app.Use(func(c *fiber.Ctx) error {
+ c.Bind(fiber.Map{
+ "Title": "Hello, World!",
+ })
+})
+
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("xxx.tmpl", fiber.Map{}) // Render will use Title variable
+})
+```
+
+## BodyRaw
+
+Returns the raw request **body**.
+
+```go title="Signature"
+func (c *Ctx) BodyRaw() []byte
+```
+
+```go title="Example"
+// curl -X POST http://localhost:8080 -d user=john
+
+app.Post("/", func(c *fiber.Ctx) error {
+ // Get raw body from POST request:
+ return c.Send(c.BodyRaw()) // []byte("user=john")
+})
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## Body
+
+As per the header `Content-Encoding`, this method will try to perform a file decompression from the **body** bytes. In case no `Content-Encoding` header is sent, it will perform as [BodyRaw](#bodyraw).
+
+```go title="Signature"
+func (c *Ctx) Body() []byte
+```
+
+```go title="Example"
+// echo 'user=john' | gzip | curl -v -i --data-binary @- -H "Content-Encoding: gzip" http://localhost:8080
+
+app.Post("/", func(c *fiber.Ctx) error {
+ // Decompress body from POST request based on the Content-Encoding and return the raw content:
+ return c.Send(c.Body()) // []byte("user=john")
+})
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## BodyParser
+
+Binds the request body to a struct.
+
+It is important to specify the correct struct tag based on the content type to be parsed. For example, if you want to parse a JSON body with a field called Pass, you would use a struct field of `json:"pass"`.
+
+| content-type | struct tag |
+| ----------------------------------- | ---------- |
+| `application/x-www-form-urlencoded` | form |
+| `multipart/form-data` | form |
+| `application/json` | json |
+| `application/xml` | xml |
+| `text/xml` | xml |
+
+```go title="Signature"
+func (c *Ctx) BodyParser(out interface{}) error
+```
+
+```go title="Example"
+// Field names should start with an uppercase letter
+type Person struct {
+ Name string `json:"name" xml:"name" form:"name"`
+ Pass string `json:"pass" xml:"pass" form:"pass"`
+}
+
+app.Post("/", func(c *fiber.Ctx) error {
+ p := new(Person)
+
+ if err := c.BodyParser(p); err != nil {
+ return err
+ }
+
+ log.Println(p.Name) // john
+ log.Println(p.Pass) // doe
+
+ // ...
+})
+
+// Run tests with the following curl commands
+
+// curl -X POST -H "Content-Type: application/json" --data "{\"name\":\"john\",\"pass\":\"doe\"}" localhost:3000
+
+// curl -X POST -H "Content-Type: application/xml" --data "johndoe" localhost:3000
+
+// curl -X POST -H "Content-Type: application/x-www-form-urlencoded" --data "name=john&pass=doe" localhost:3000
+
+// curl -X POST -F name=john -F pass=doe http://localhost:3000
+
+// curl -X POST "http://localhost:3000/?name=john&pass=doe"
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## ClearCookie
+
+Expire a client cookie \(_or all cookies if left empty\)_
+
+```go title="Signature"
+func (c *Ctx) ClearCookie(key ...string)
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ // Clears all cookies:
+ c.ClearCookie()
+
+ // Expire specific cookie by name:
+ c.ClearCookie("user")
+
+ // Expire multiple cookies by names:
+ c.ClearCookie("token", "session", "track_id", "version")
+ // ...
+})
+```
+
+:::caution
+Web browsers and other compliant clients will only clear the cookie if the given options are identical to those when creating the cookie, excluding expires and maxAge. ClearCookie will not set these values for you - a technique similar to the one shown below should be used to ensure your cookie is deleted.
+:::
+
+```go title="Example"
+app.Get("/set", func(c *fiber.Ctx) error {
+ c.Cookie(&fiber.Cookie{
+ Name: "token",
+ Value: "randomvalue",
+ Expires: time.Now().Add(24 * time.Hour),
+ HTTPOnly: true,
+ SameSite: "lax",
+ })
+
+ // ...
+})
+
+app.Get("/delete", func(c *fiber.Ctx) error {
+ c.Cookie(&fiber.Cookie{
+ Name: "token",
+ // Set expiry date to the past
+ Expires: time.Now().Add(-(time.Hour * 2)),
+ HTTPOnly: true,
+ SameSite: "lax",
+ })
+
+ // ...
+})
+```
+
+## ClientHelloInfo
+
+ClientHelloInfo contains information from a ClientHello message in order to guide application logic in the GetCertificate and GetConfigForClient callbacks.
+You can refer to the [ClientHelloInfo](https://golang.org/pkg/crypto/tls/#ClientHelloInfo) struct documentation for more information on the returned struct.
+
+```go title="Signature"
+func (c *Ctx) ClientHelloInfo() *tls.ClientHelloInfo
+```
+
+```go title="Example"
+// GET http://example.com/hello
+app.Get("/hello", func(c *fiber.Ctx) error {
+ chi := c.ClientHelloInfo()
+ // ...
+})
+```
+
+## Context
+
+Returns [\*fasthttp.RequestCtx](https://godoc.org/github.com/valyala/fasthttp#RequestCtx) that is compatible with the context.Context interface that requires a deadline, a cancellation signal, and other values across API boundaries.
+
+```go title="Signature"
+func (c *Ctx) Context() *fasthttp.RequestCtx
+```
+
+:::info
+Please read the [Fasthttp Documentation](https://pkg.go.dev/github.com/valyala/fasthttp?tab=doc) for more information.
+:::
+
+## Cookie
+
+Set cookie
+
+```go title="Signature"
+func (c *Ctx) Cookie(cookie *Cookie)
+```
+
+```go
+type Cookie struct {
+ Name string `json:"name"`
+ Value string `json:"value"`
+ Path string `json:"path"`
+ Domain string `json:"domain"`
+ MaxAge int `json:"max_age"`
+ Expires time.Time `json:"expires"`
+ Secure bool `json:"secure"`
+ HTTPOnly bool `json:"http_only"`
+ SameSite string `json:"same_site"`
+ SessionOnly bool `json:"session_only"`
+}
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ // Create cookie
+ cookie := new(fiber.Cookie)
+ cookie.Name = "john"
+ cookie.Value = "doe"
+ cookie.Expires = time.Now().Add(24 * time.Hour)
+
+ // Set cookie
+ c.Cookie(cookie)
+ // ...
+})
+```
+
+## CookieParser
+
+This method is similar to [BodyParser](ctx.md#bodyparser), but for cookie parameters.
+It is important to use the struct tag "cookie". For example, if you want to parse a cookie with a field called Age, you would use a struct field of `cookie:"age"`.
+
+```go title="Signature"
+func (c *Ctx) CookieParser(out interface{}) error
+```
+
+```go title="Example"
+// Field names should start with an uppercase letter
+type Person struct {
+ Name string `cookie:"name"`
+ Age int `cookie:"age"`
+ Job bool `cookie:"job"`
+}
+
+app.Get("/", func(c *fiber.Ctx) error {
+ p := new(Person)
+
+ if err := c.CookieParser(p); err != nil {
+ return err
+ }
+
+ log.Println(p.Name) // Joseph
+ log.Println(p.Age) // 23
+ log.Println(p.Job) // true
+})
+// Run tests with the following curl command
+// curl.exe --cookie "name=Joseph; age=23; job=true" http://localhost:8000/
+```
+
+## Cookies
+
+Get cookie value by key, you could pass an optional default value that will be returned if the cookie key does not exist.
+
+```go title="Signature"
+func (c *Ctx) Cookies(key string, defaultValue ...string) string
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ // Get cookie by key:
+ c.Cookies("name") // "john"
+ c.Cookies("empty", "doe") // "doe"
+ // ...
+})
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## Download
+
+Transfers the file from path as an `attachment`.
+
+Typically, browsers will prompt the user to download. By default, the [Content-Disposition](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) header `filename=` parameter is the file path \(_this typically appears in the browser dialog_\).
+
+Override this default with the **filename** parameter.
+
+```go title="Signature"
+func (c *Ctx) Download(file string, filename ...string) error
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.Download("./files/report-12345.pdf");
+ // => Download report-12345.pdf
+
+ return c.Download("./files/report-12345.pdf", "report.pdf");
+ // => Download report.pdf
+})
+```
+
+## Format
+
+Performs content-negotiation on the [Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept) HTTP header. It uses [Accepts](ctx.md#accepts) to select a proper format.
+
+:::info
+If the header is **not** specified or there is **no** proper format, **text/plain** is used.
+:::
+
+```go title="Signature"
+func (c *Ctx) Format(body interface{}) error
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ // Accept: text/plain
+ c.Format("Hello, World!")
+ // => Hello, World!
+
+ // Accept: text/html
+ c.Format("Hello, World!")
+ // =>
Hello, World!
+
+ // Accept: application/json
+ c.Format("Hello, World!")
+ // => "Hello, World!"
+ // ..
+})
+```
+
+## FormFile
+
+MultipartForm files can be retrieved by name, the **first** file from the given key is returned.
+
+```go title="Signature"
+func (c *Ctx) FormFile(key string) (*multipart.FileHeader, error)
+```
+
+```go title="Example"
+app.Post("/", func(c *fiber.Ctx) error {
+ // Get first file from form field "document":
+ file, err := c.FormFile("document")
+
+ // Save file to root directory:
+ return c.SaveFile(file, fmt.Sprintf("./%s", file.Filename))
+})
+```
+
+## FormValue
+
+Any form values can be retrieved by name, the **first** value from the given key is returned.
+
+```go title="Signature"
+func (c *Ctx) FormValue(key string, defaultValue ...string) string
+```
+
+```go title="Example"
+app.Post("/", func(c *fiber.Ctx) error {
+ // Get first value from form field "name":
+ c.FormValue("name")
+ // => "john" or "" if not exist
+
+ // ..
+})
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## Fresh
+
+When the response is still **fresh** in the client's cache **true** is returned, otherwise **false** is returned to indicate that the client cache is now stale and the full response should be sent.
+
+When a client sends the Cache-Control: no-cache request header to indicate an end-to-end reload request, `Fresh` will return false to make handling these requests transparent.
+
+Read more on [https://expressjs.com/en/4x/api.html\#req.fresh](https://expressjs.com/en/4x/api.html#req.fresh)
+
+```go title="Signature"
+func (c *Ctx) Fresh() bool
+```
+
+## Get
+
+Returns the HTTP request header specified by the field.
+
+:::tip
+The match is **case-insensitive**.
+:::
+
+```go title="Signature"
+func (c *Ctx) Get(key string, defaultValue ...string) string
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Get("Content-Type") // "text/plain"
+ c.Get("CoNtEnT-TypE") // "text/plain"
+ c.Get("something", "john") // "john"
+ // ..
+})
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## GetReqHeaders
+
+Returns the HTTP request headers as a map. Since a header can be set multiple times in a single request, the values of the map are slices of strings containing all the different values of the header.
+
+```go title="Signature"
+func (c *Ctx) GetReqHeaders() map[string][]string
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## GetRespHeader
+
+Returns the HTTP response header specified by the field.
+
+:::tip
+The match is **case-insensitive**.
+:::
+
+```go title="Signature"
+func (c *Ctx) GetRespHeader(key string, defaultValue ...string) string
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.GetRespHeader("X-Request-Id") // "8d7ad5e3-aaf3-450b-a241-2beb887efd54"
+ c.GetRespHeader("Content-Type") // "text/plain"
+ c.GetRespHeader("something", "john") // "john"
+ // ..
+})
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## GetRespHeaders
+
+Returns the HTTP response headers as a map. Since a header can be set multiple times in a single request, the values of the map are slices of strings containing all the different values of the header.
+
+```go title="Signature"
+func (c *Ctx) GetRespHeaders() map[string][]string
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## GetRouteURL
+
+Generates URLs to named routes, with parameters. URLs are relative, for example: "/user/1831"
+
+```go title="Signature"
+func (c *Ctx) GetRouteURL(routeName string, params Map) (string, error)
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Home page")
+}).Name("home")
+
+app.Get("/user/:id", func(c *fiber.Ctx) error {
+ return c.SendString(c.Params("id"))
+}).Name("user.show")
+
+app.Get("/test", func(c *fiber.Ctx) error {
+ location, _ := c.GetRouteURL("user.show", fiber.Map{"id": 1})
+ return c.SendString(location)
+})
+
+// /test returns "/user/1"
+```
+
+## Hostname
+
+Returns the hostname derived from the [Host](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host) HTTP header.
+
+```go title="Signature"
+func (c *Ctx) Hostname() string
+```
+
+```go title="Example"
+// GET http://google.com/search
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Hostname() // "google.com"
+
+ // ...
+})
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## IP
+
+Returns the remote IP address of the request.
+
+```go title="Signature"
+func (c *Ctx) IP() string
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.IP() // "127.0.0.1"
+
+ // ...
+})
+```
+
+When registering the proxy request header in the fiber app, the ip address of the header is returned [(Fiber configuration)](fiber.md#config)
+
+```go
+app := fiber.New(fiber.Config{
+ ProxyHeader: fiber.HeaderXForwardedFor,
+})
+```
+
+## IPs
+
+Returns an array of IP addresses specified in the [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For) request header.
+
+```go title="Signature"
+func (c *Ctx) IPs() []string
+```
+
+```go title="Example"
+// X-Forwarded-For: proxy1, 127.0.0.1, proxy3
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.IPs() // ["proxy1", "127.0.0.1", "proxy3"]
+
+ // ...
+})
+```
+
+:::caution
+Improper use of the X-Forwarded-For header can be a security risk. For details, see the [Security and privacy concerns](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For#security_and_privacy_concerns) section.
+:::
+
+## Is
+
+Returns the matching **content type**, if the incoming request’s [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) HTTP header field matches the [MIME type](https://developer.mozilla.org/ru/docs/Web/HTTP/Basics_of_HTTP/MIME_types) specified by the type parameter.
+
+:::info
+If the request has **no** body, it returns **false**.
+:::
+
+```go title="Signature"
+func (c *Ctx) Is(extension string) bool
+```
+
+```go title="Example"
+// Content-Type: text/html; charset=utf-8
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Is("html") // true
+ c.Is(".html") // true
+ c.Is("json") // false
+
+ // ...
+})
+```
+
+## IsFromLocal
+
+Returns true if request came from localhost
+
+```go title="Signature"
+func (c *Ctx) IsFromLocal() bool {
+```
+
+```go title="Example"
+
+app.Get("/", func(c *fiber.Ctx) error {
+ // If request came from localhost, return true else return false
+ c.IsFromLocal()
+
+ // ...
+})
+```
+
+## JSON
+
+Converts any **interface** or **string** to JSON using the [encoding/json](https://pkg.go.dev/encoding/json) package.
+
+:::info
+JSON also sets the content header to the `ctype` parameter. If no `ctype` is passed in, the header is set to `application/json`.
+:::
+
+```go title="Signature"
+func (c *Ctx) JSON(data interface{}, ctype ...string) error
+```
+
+```go title="Example"
+type SomeStruct struct {
+ Name string
+ Age uint8
+}
+
+app.Get("/json", func(c *fiber.Ctx) error {
+ // Create data struct:
+ data := SomeStruct{
+ Name: "Grame",
+ Age: 20,
+ }
+
+ return c.JSON(data)
+ // => Content-Type: application/json
+ // => "{"Name": "Grame", "Age": 20}"
+
+ return c.JSON(fiber.Map{
+ "name": "Grame",
+ "age": 20,
+ })
+ // => Content-Type: application/json
+ // => "{"name": "Grame", "age": 20}"
+
+ return c.JSON(fiber.Map{
+ "type": "https://example.com/probs/out-of-credit",
+ "title": "You do not have enough credit.",
+ "status": 403,
+ "detail": "Your current balance is 30, but that costs 50.",
+ "instance": "/account/12345/msgs/abc",
+ }, "application/problem+json")
+ // => Content-Type: application/problem+json
+ // => "{
+ // => "type": "https://example.com/probs/out-of-credit",
+ // => "title": "You do not have enough credit.",
+ // => "status": 403,
+ // => "detail": "Your current balance is 30, but that costs 50.",
+ // => "instance": "/account/12345/msgs/abc",
+ // => }"
+})
+```
+
+## JSONP
+
+Sends a JSON response with JSONP support. This method is identical to [JSON](ctx.md#json), except that it opts-in to JSONP callback support. By default, the callback name is simply callback.
+
+Override this by passing a **named string** in the method.
+
+```go title="Signature"
+func (c *Ctx) JSONP(data interface{}, callback ...string) error
+```
+
+```go title="Example"
+type SomeStruct struct {
+ name string
+ age uint8
+}
+
+app.Get("/", func(c *fiber.Ctx) error {
+ // Create data struct:
+ data := SomeStruct{
+ name: "Grame",
+ age: 20,
+ }
+
+ return c.JSONP(data)
+ // => callback({"name": "Grame", "age": 20})
+
+ return c.JSONP(data, "customFunc")
+ // => customFunc({"name": "Grame", "age": 20})
+})
+```
+
+## Links
+
+Joins the links followed by the property to populate the response’s [Link](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link) HTTP header field.
+
+```go title="Signature"
+func (c *Ctx) Links(link ...string)
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Links(
+ "http://api.example.com/users?page=2", "next",
+ "http://api.example.com/users?page=5", "last",
+ )
+ // Link: ; rel="next",
+ // ; rel="last"
+
+ // ...
+})
+```
+
+## Locals
+
+A method that stores variables scoped to the request and, therefore, are available only to the routes that match the request. The stored variables are removed after the request is handled. If any of the stored data implements the `io.Closer` interface, its `Close` method will be called before it's removed.
+
+:::tip
+This is useful if you want to pass some **specific** data to the next middleware. Remember to perform type assertions when retrieving the data to ensure it is of the expected type. You can also use a non-exported type as a key to avoid collisions.
+:::
+
+```go title="Signature"
+func (c *Ctx) Locals(key interface{}, value ...interface{}) interface{}
+```
+
+```go title="Example"
+type keyType struct{}
+var userKey keyType
+
+app.Use(func(c *fiber.Ctx) error {
+ c.Locals(userKey, "admin") // Stores the string "admin" under a non-exported type key
+ return c.Next()
+})
+
+app.Get("/admin", func(c *fiber.Ctx) error {
+ user, ok := c.Locals(userKey).(string) // Retrieves the data stored under the key and performs a type assertion
+ if ok && user == "admin" {
+ return c.Status(fiber.StatusOK).SendString("Welcome, admin!")
+ }
+ return c.SendStatus(fiber.StatusForbidden)
+})
+```
+
+## Location
+
+Sets the response [Location](https://developer.mozilla.org/ru/docs/Web/HTTP/Headers/Location) HTTP header to the specified path parameter.
+
+```go title="Signature"
+func (c *Ctx) Location(path string)
+```
+
+```go title="Example"
+app.Post("/", func(c *fiber.Ctx) error {
+ c.Location("http://example.com")
+
+ c.Location("/foo/bar")
+
+ return nil
+})
+```
+
+## Method
+
+Returns a string corresponding to the HTTP method of the request: `GET`, `POST`, `PUT`, and so on.
+Optionally, you could override the method by passing a string.
+
+```go title="Signature"
+func (c *Ctx) Method(override ...string) string
+```
+
+```go title="Example"
+app.Post("/", func(c *fiber.Ctx) error {
+ c.Method() // "POST"
+
+ c.Method("GET")
+ c.Method() // GET
+
+ // ...
+})
+```
+
+## MultipartForm
+
+To access multipart form entries, you can parse the binary with `MultipartForm()`. This returns a `map[string][]string`, so given a key, the value will be a string slice.
+
+```go title="Signature"
+func (c *Ctx) MultipartForm() (*multipart.Form, error)
+```
+
+```go title="Example"
+app.Post("/", func(c *fiber.Ctx) error {
+ // Parse the multipart form:
+ if form, err := c.MultipartForm(); err == nil {
+ // => *multipart.Form
+
+ if token := form.Value["token"]; len(token) > 0 {
+ // Get key value:
+ fmt.Println(token[0])
+ }
+
+ // Get all files from "documents" key:
+ files := form.File["documents"]
+ // => []*multipart.FileHeader
+
+ // Loop through files:
+ for _, file := range files {
+ fmt.Println(file.Filename, file.Size, file.Header["Content-Type"][0])
+ // => "tutorial.pdf" 360641 "application/pdf"
+
+ // Save the files to disk:
+ if err := c.SaveFile(file, fmt.Sprintf("./%s", file.Filename)); err != nil {
+ return err
+ }
+ }
+ }
+
+ return err
+})
+```
+
+## Next
+
+When **Next** is called, it executes the next method in the stack that matches the current route. You can pass an error struct within the method that will end the chaining and call the [error handler](https://docs.gofiber.io/guide/error-handling).
+
+```go title="Signature"
+func (c *Ctx) Next() error
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ fmt.Println("1st route!")
+ return c.Next()
+})
+
+app.Get("*", func(c *fiber.Ctx) error {
+ fmt.Println("2nd route!")
+ return c.Next()
+})
+
+app.Get("/", func(c *fiber.Ctx) error {
+ fmt.Println("3rd route!")
+ return c.SendString("Hello, World!")
+})
+```
+
+## OriginalURL
+
+Returns the original request URL.
+
+```go title="Signature"
+func (c *Ctx) OriginalURL() string
+```
+
+```go title="Example"
+// GET http://example.com/search?q=something
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.OriginalURL() // "/search?q=something"
+
+ // ...
+})
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## Params
+
+Method can be used to get the route parameters, you could pass an optional default value that will be returned if the param key does not exist.
+
+:::info
+Defaults to empty string \(`""`\), if the param **doesn't** exist.
+:::
+
+```go title="Signature"
+func (c *Ctx) Params(key string, defaultValue ...string) string
+```
+
+```go title="Example"
+// GET http://example.com/user/fenny
+app.Get("/user/:name", func(c *fiber.Ctx) error {
+ c.Params("name") // "fenny"
+
+ // ...
+})
+
+// GET http://example.com/user/fenny/123
+app.Get("/user/*", func(c *fiber.Ctx) error {
+ c.Params("*") // "fenny/123"
+ c.Params("*1") // "fenny/123"
+
+ // ...
+})
+```
+
+Unnamed route parameters\(\*, +\) can be fetched by the **character** and the **counter** in the route.
+
+```go title="Example"
+// ROUTE: /v1/*/shop/*
+// GET: /v1/brand/4/shop/blue/xs
+c.Params("*1") // "brand/4"
+c.Params("*2") // "blue/xs"
+```
+
+For reasons of **downward compatibility**, the first parameter segment for the parameter character can also be accessed without the counter.
+
+```go title="Example"
+app.Get("/v1/*/shop/*", func(c *fiber.Ctx) error {
+ c.Params("*") // outputs the values of the first wildcard segment
+})
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## ParamsInt
+
+Method can be used to get an integer from the route parameters.
+Please note if that parameter is not in the request, zero
+will be returned. If the parameter is NOT a number, zero and an error
+will be returned
+
+:::info
+Defaults to the integer zero \(`0`\), if the param **doesn't** exist.
+:::
+
+```go title="Signature"
+func (c *Ctx) ParamsInt(key string) (int, error)
+```
+
+```go title="Example"
+// GET http://example.com/user/123
+app.Get("/user/:id", func(c *fiber.Ctx) error {
+ id, err := c.ParamsInt("id") // int 123 and no error
+
+ // ...
+})
+
+```
+
+This method is equivalent of using `atoi` with ctx.Params
+
+## ParamsParser
+
+This method is similar to BodyParser, but for path parameters. It is important to use the struct tag "params". For example, if you want to parse a path parameter with a field called Pass, you would use a struct field of params:"pass"
+
+```go title="Signature"
+func (c *Ctx) ParamsParser(out interface{}) error
+```
+
+```go title="Example"
+// GET http://example.com/user/111
+app.Get("/user/:id", func(c *fiber.Ctx) error {
+ param := struct {ID uint `params:"id"`}{}
+
+ c.ParamsParser(¶m) // "{"id": 111}"
+
+ // ...
+})
+
+```
+
+## Path
+
+Contains the path part of the request URL. Optionally, you could override the path by passing a string. For internal redirects, you might want to call [RestartRouting](ctx.md#restartrouting) instead of [Next](ctx.md#next).
+
+```go title="Signature"
+func (c *Ctx) Path(override ...string) string
+```
+
+```go title="Example"
+// GET http://example.com/users?sort=desc
+
+app.Get("/users", func(c *fiber.Ctx) error {
+ c.Path() // "/users"
+
+ c.Path("/john")
+ c.Path() // "/john"
+
+ // ...
+})
+```
+
+## Protocol
+
+Contains the request protocol string: `http` or `https` for **TLS** requests.
+
+```go title="Signature"
+func (c *Ctx) Protocol() string
+```
+
+```go title="Example"
+// GET http://example.com
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Protocol() // "http"
+
+ // ...
+})
+```
+
+## Queries
+
+Queries is a function that returns an object containing a property for each query string parameter in the route.
+
+```go title="Signature"
+func (c *Ctx) Queries() map[string]string
+```
+
+```go title="Example"
+// GET http://example.com/?name=alex&want_pizza=false&id=
+
+app.Get("/", func(c *fiber.Ctx) error {
+ m := c.Queries()
+ m["name"] // "alex"
+ m["want_pizza"] // "false"
+ m["id"] // ""
+ // ...
+})
+```
+
+```go title="Example"
+// GET http://example.com/?field1=value1&field1=value2&field2=value3
+
+app.Get("/", func (c *fiber.Ctx) error {
+ m := c.Queries()
+ m["field1"] // "value2"
+ m["field2"] // value3
+})
+```
+
+```go title="Example"
+// GET http://example.com/?list_a=1&list_a=2&list_a=3&list_b[]=1&list_b[]=2&list_b[]=3&list_c=1,2,3
+
+app.Get("/", func(c *fiber.Ctx) error {
+ m := c.Queries()
+ m["list_a"] // "3"
+ m["list_b[]"] // "3"
+ m["list_c"] // "1,2,3"
+})
+```
+
+```go title="Example"
+// GET /api/posts?filters.author.name=John&filters.category.name=Technology
+
+app.Get("/", func(c *fiber.Ctx) error {
+ m := c.Queries()
+ m["filters.author.name"] // John
+ m["filters.category.name"] // Technology
+})
+```
+
+```go title="Example"
+// GET /api/posts?tags=apple,orange,banana&filters[tags]=apple,orange,banana&filters[category][name]=fruits&filters.tags=apple,orange,banana&filters.category.name=fruits
+
+app.Get("/", func(c *fiber.Ctx) error {
+ m := c.Queries()
+ m["tags"] // apple,orange,banana
+ m["filters[tags]"] // apple,orange,banana
+ m["filters[category][name]"] // fruits
+ m["filters.tags"] // apple,orange,banana
+ m["filters.category.name"] // fruits
+})
+```
+
+## Query
+
+This property is an object containing a property for each query string parameter in the route, you could pass an optional default value that will be returned if the query key does not exist.
+
+:::info
+If there is **no** query string, it returns an **empty string**.
+:::
+
+```go title="Signature"
+func (c *Ctx) Query(key string, defaultValue ...string) string
+```
+
+```go title="Example"
+// GET http://example.com/?order=desc&brand=nike
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Query("order") // "desc"
+ c.Query("brand") // "nike"
+ c.Query("empty", "nike") // "nike"
+
+ // ...
+})
+```
+
+> _Returned value is only valid within the handler. Do not store any references.
+> Make copies or use the_ [_**`Immutable`**_](ctx.md) _setting instead._ [_Read more..._](../#zero-allocation)
+
+## QueryBool
+
+This property is an object containing a property for each query boolean parameter in the route, you could pass an optional default value that will be returned if the query key does not exist.
+
+:::caution
+Please note if that parameter is not in the request, false will be returned.
+If the parameter is not a boolean, it is still tried to be converted and usually returned as false.
+:::
+
+```go title="Signature"
+func (c *Ctx) QueryBool(key string, defaultValue ...bool) bool
+```
+
+```go title="Example"
+// GET http://example.com/?name=alex&want_pizza=false&id=
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.QueryBool("want_pizza") // false
+ c.QueryBool("want_pizza", true) // false
+ c.QueryBool("name") // false
+ c.QueryBool("name", true) // true
+ c.QueryBool("id") // false
+ c.QueryBool("id", true) // true
+
+ // ...
+})
+```
+
+## QueryFloat
+
+This property is an object containing a property for each query float64 parameter in the route, you could pass an optional default value that will be returned if the query key does not exist.
+
+:::caution
+Please note if that parameter is not in the request, zero will be returned.
+If the parameter is not a number, it is still tried to be converted and usually returned as 1.
+:::
+
+:::info
+Defaults to the float64 zero \(`0`\), if the param **doesn't** exist.
+:::
+
+```go title="Signature"
+func (c *Ctx) QueryFloat(key string, defaultValue ...float64) float64
+```
+
+```go title="Example"
+// GET http://example.com/?name=alex&amount=32.23&id=
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.QueryFloat("amount") // 32.23
+ c.QueryFloat("amount", 3) // 32.23
+ c.QueryFloat("name", 1) // 1
+ c.QueryFloat("name") // 0
+ c.QueryFloat("id", 3) // 3
+
+ // ...
+})
+```
+
+## QueryInt
+
+This property is an object containing a property for each query integer parameter in the route, you could pass an optional default value that will be returned if the query key does not exist.
+
+:::caution
+Please note if that parameter is not in the request, zero will be returned.
+If the parameter is not a number, it is still tried to be converted and usually returned as 1.
+:::
+
+:::info
+Defaults to the integer zero \(`0`\), if the param **doesn't** exist.
+:::
+
+```go title="Signature"
+func (c *Ctx) QueryInt(key string, defaultValue ...int) int
+```
+
+```go title="Example"
+// GET http://example.com/?name=alex&wanna_cake=2&id=
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.QueryInt("wanna_cake", 1) // 2
+ c.QueryInt("name", 1) // 1
+ c.QueryInt("id", 1) // 1
+ c.QueryInt("id") // 0
+
+ // ...
+})
+```
+
+## QueryParser
+
+This method is similar to [BodyParser](ctx.md#bodyparser), but for query parameters.
+It is important to use the struct tag "query". For example, if you want to parse a query parameter with a field called Pass, you would use a struct field of `query:"pass"`.
+
+```go title="Signature"
+func (c *Ctx) QueryParser(out interface{}) error
+```
+
+```go title="Example"
+// Field names should start with an uppercase letter
+type Person struct {
+ Name string `query:"name"`
+ Pass string `query:"pass"`
+ Products []string `query:"products"`
+}
+
+app.Get("/", func(c *fiber.Ctx) error {
+ p := new(Person)
+
+ if err := c.QueryParser(p); err != nil {
+ return err
+ }
+
+ log.Println(p.Name) // john
+ log.Println(p.Pass) // doe
+ // fiber.Config{EnableSplittingOnParsers: false} - default
+ log.Println(p.Products) // ["shoe,hat"]
+ // fiber.Config{EnableSplittingOnParsers: true}
+ // log.Println(p.Products) // ["shoe", "hat"]
+
+
+ // ...
+})
+// Run tests with the following curl command
+
+// curl "http://localhost:3000/?name=john&pass=doe&products=shoe,hat"
+```
+
+:::info
+For more parser settings please look here [Config](fiber.md#config)
+:::
+
+## Range
+
+A struct containing the type and a slice of ranges will be returned.
+
+```go title="Signature"
+func (c *Ctx) Range(size int) (Range, error)
+```
+
+```go title="Example"
+// Range: bytes=500-700, 700-900
+app.Get("/", func(c *fiber.Ctx) error {
+ b := c.Range(1000)
+ if b.Type == "bytes" {
+ for r := range r.Ranges {
+ fmt.Println(r)
+ // [500, 700]
+ }
+ }
+})
+```
+
+## Redirect
+
+Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code.
+
+:::info
+If **not** specified, status defaults to **302 Found**.
+:::
+
+```go title="Signature"
+func (c *Ctx) Redirect(location string, status ...int) error
+```
+
+```go title="Example"
+app.Get("/coffee", func(c *fiber.Ctx) error {
+ return c.Redirect("/teapot")
+})
+
+app.Get("/teapot", func(c *fiber.Ctx) error {
+ return c.Status(fiber.StatusTeapot).Send("🍵 short and stout 🍵")
+})
+```
+
+```go title="More examples"
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.Redirect("/foo/bar")
+ return c.Redirect("../login")
+ return c.Redirect("http://example.com")
+ return c.Redirect("http://example.com", 301)
+})
+```
+
+## RedirectToRoute
+
+Redirects to the specific route along with the parameters and with specified status, a positive integer that corresponds to an HTTP status code.
+
+:::info
+If **not** specified, status defaults to **302 Found**.
+:::
+
+:::info
+If you want to send queries to route, you must add **"queries"** key typed as **map[string]string** to params.
+:::
+
+```go title="Signature"
+func (c *Ctx) RedirectToRoute(routeName string, params fiber.Map, status ...int) error
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ // /user/fiber
+ return c.RedirectToRoute("user", fiber.Map{
+ "name": "fiber"
+ })
+})
+
+app.Get("/with-queries", func(c *fiber.Ctx) error {
+ // /user/fiber?data[0][name]=john&data[0][age]=10&test=doe
+ return c.RedirectToRoute("user", fiber.Map{
+ "name": "fiber",
+ "queries": map[string]string{"data[0][name]": "john", "data[0][age]": "10", "test": "doe"},
+ })
+})
+
+app.Get("/user/:name", func(c *fiber.Ctx) error {
+ return c.SendString(c.Params("name"))
+}).Name("user")
+```
+
+## RedirectBack
+
+Redirects back to refer URL. It redirects to fallback URL if refer header doesn't exists, with specified status, a positive integer that corresponds to an HTTP status code.
+
+:::info
+If **not** specified, status defaults to **302 Found**.
+:::
+
+```go title="Signature"
+func (c *Ctx) RedirectBack(fallback string, status ...int) error
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Home page")
+})
+app.Get("/test", func(c *fiber.Ctx) error {
+ c.Set("Content-Type", "text/html")
+ return c.SendString(`Back`)
+})
+
+app.Get("/back", func(c *fiber.Ctx) error {
+ return c.RedirectBack("/")
+})
+```
+
+## Render
+
+Renders a view with data and sends a `text/html` response. By default `Render` uses the default [**Go Template engine**](https://pkg.go.dev/html/template/). If you want to use another View engine, please take a look at our [**Template middleware**](https://docs.gofiber.io/template).
+
+```go title="Signature"
+func (c *Ctx) Render(name string, bind interface{}, layouts ...string) error
+```
+
+## Request
+
+Request return the [\*fasthttp.Request](https://godoc.org/github.com/valyala/fasthttp#Request) pointer
+
+```go title="Signature"
+func (c *Ctx) Request() *fasthttp.Request
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Request().Header.Method()
+ // => []byte("GET")
+})
+```
+
+## ReqHeaderParser
+
+This method is similar to [BodyParser](ctx.md#bodyparser), but for request headers.
+It is important to use the struct tag "reqHeader". For example, if you want to parse a request header with a field called Pass, you would use a struct field of `reqHeader:"pass"`.
+
+```go title="Signature"
+func (c *Ctx) ReqHeaderParser(out interface{}) error
+```
+
+```go title="Example"
+// Field names should start with an uppercase letter
+type Person struct {
+ Name string `reqHeader:"name"`
+ Pass string `reqHeader:"pass"`
+ Products []string `reqHeader:"products"`
+}
+
+app.Get("/", func(c *fiber.Ctx) error {
+ p := new(Person)
+
+ if err := c.ReqHeaderParser(p); err != nil {
+ return err
+ }
+
+ log.Println(p.Name) // john
+ log.Println(p.Pass) // doe
+ log.Println(p.Products) // [shoe, hat]
+
+ // ...
+})
+// Run tests with the following curl command
+
+// curl "http://localhost:3000/" -H "name: john" -H "pass: doe" -H "products: shoe,hat"
+```
+
+## Response
+
+Response return the [\*fasthttp.Response](https://godoc.org/github.com/valyala/fasthttp#Response) pointer
+
+```go title="Signature"
+func (c *Ctx) Response() *fasthttp.Response
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Response().BodyWriter().Write([]byte("Hello, World!"))
+ // => "Hello, World!"
+ return nil
+})
+```
+
+## RestartRouting
+
+Instead of executing the next method when calling [Next](ctx.md#next), **RestartRouting** restarts execution from the first method that matches the current route. This may be helpful after overriding the path, i. e. an internal redirect. Note that handlers might be executed again which could result in an infinite loop.
+
+```go title="Signature"
+func (c *Ctx) RestartRouting() error
+```
+
+```go title="Example"
+app.Get("/new", func(c *fiber.Ctx) error {
+ return c.SendString("From /new")
+})
+
+app.Get("/old", func(c *fiber.Ctx) error {
+ c.Path("/new")
+ return c.RestartRouting()
+})
+```
+
+## Route
+
+Returns the matched [Route](https://pkg.go.dev/github.com/gofiber/fiber?tab=doc#Route) struct.
+
+```go title="Signature"
+func (c *Ctx) Route() *Route
+```
+
+```go title="Example"
+// http://localhost:8080/hello
+
+
+app.Get("/hello/:name", func(c *fiber.Ctx) error {
+ r := c.Route()
+ fmt.Println(r.Method, r.Path, r.Params, r.Handlers)
+ // GET /hello/:name handler [name]
+
+ // ...
+})
+```
+
+:::caution
+Do not rely on `c.Route()` in middlewares **before** calling `c.Next()` - `c.Route()` returns the **last executed route**.
+:::
+
+```go title="Example"
+func MyMiddleware() fiber.Handler {
+ return func(c *fiber.Ctx) error {
+ beforeNext := c.Route().Path // Will be '/'
+ err := c.Next()
+ afterNext := c.Route().Path // Will be '/hello/:name'
+ return err
+ }
+}
+```
+
+## SaveFile
+
+Method is used to save **any** multipart file to disk.
+
+```go title="Signature"
+func (c *Ctx) SaveFile(fh *multipart.FileHeader, path string) error
+```
+
+```go title="Example"
+app.Post("/", func(c *fiber.Ctx) error {
+ // Parse the multipart form:
+ if form, err := c.MultipartForm(); err == nil {
+ // => *multipart.Form
+
+ // Get all files from "documents" key:
+ files := form.File["documents"]
+ // => []*multipart.FileHeader
+
+ // Loop through files:
+ for _, file := range files {
+ fmt.Println(file.Filename, file.Size, file.Header["Content-Type"][0])
+ // => "tutorial.pdf" 360641 "application/pdf"
+
+ // Save the files to disk:
+ if err := c.SaveFile(file, fmt.Sprintf("./%s", file.Filename)); err != nil {
+ return err
+ }
+ }
+ return err
+ }
+})
+```
+
+## SaveFileToStorage
+
+Method is used to save **any** multipart file to an external storage system.
+
+```go title="Signature"
+func (c *Ctx) SaveFileToStorage(fileheader *multipart.FileHeader, path string, storage Storage) error
+```
+
+```go title="Example"
+storage := memory.New()
+
+app.Post("/", func(c *fiber.Ctx) error {
+ // Parse the multipart form:
+ if form, err := c.MultipartForm(); err == nil {
+ // => *multipart.Form
+
+ // Get all files from "documents" key:
+ files := form.File["documents"]
+ // => []*multipart.FileHeader
+
+ // Loop through files:
+ for _, file := range files {
+ fmt.Println(file.Filename, file.Size, file.Header["Content-Type"][0])
+ // => "tutorial.pdf" 360641 "application/pdf"
+
+ // Save the files to storage:
+ if err := c.SaveFileToStorage(file, fmt.Sprintf("./%s", file.Filename), storage); err != nil {
+ return err
+ }
+ }
+ return err
+ }
+})
+```
+
+## Secure
+
+A boolean property that is `true` , if a **TLS** connection is established.
+
+```go title="Signature"
+func (c *Ctx) Secure() bool
+```
+
+```go title="Example"
+// Secure() method is equivalent to:
+c.Protocol() == "https"
+```
+
+## Send
+
+Sets the HTTP response body.
+
+```go title="Signature"
+func (c *Ctx) Send(body []byte) error
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.Send([]byte("Hello, World!")) // => "Hello, World!"
+})
+```
+
+Fiber also provides `SendString` and `SendStream` methods for raw inputs.
+
+:::tip
+Use this if you **don't need** type assertion, recommended for **faster** performance.
+:::
+
+```go title="Signature"
+func (c *Ctx) SendString(body string) error
+func (c *Ctx) SendStream(stream io.Reader, size ...int) error
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World!")
+ // => "Hello, World!"
+
+ return c.SendStream(bytes.NewReader([]byte("Hello, World!")))
+ // => "Hello, World!"
+})
+```
+
+## SendFile
+
+Transfers the file from the given path. Sets the [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) response HTTP header field based on the **filenames** extension.
+
+:::caution
+Method doesn´t use **gzipping** by default, set it to **true** to enable.
+:::
+
+```go title="Signature" title="Signature"
+func (c *Ctx) SendFile(file string, compress ...bool) error
+```
+
+```go title="Example"
+app.Get("/not-found", func(c *fiber.Ctx) error {
+ return c.SendFile("./public/404.html");
+
+ // Disable compression
+ return c.SendFile("./static/index.html", false);
+})
+```
+
+:::info
+If the file contains an url specific character you have to escape it before passing the file path into the `sendFile` function.
+:::
+
+```go title="Example"
+app.Get("/file-with-url-chars", func(c *fiber.Ctx) error {
+ return c.SendFile(url.PathEscape("hash_sign_#.txt"))
+})
+```
+
+:::info
+For sending files from embedded file system [this functionality](./middleware/filesystem.md#sendfile) can be used
+:::
+
+## SendStatus
+
+Sets the status code and the correct status message in the body, if the response body is **empty**.
+
+:::tip
+You can find all used status codes and messages [here](https://github.com/gofiber/fiber/blob/dffab20bcdf4f3597d2c74633a7705a517d2c8c2/utils.go#L183-L244).
+:::
+
+```go title="Signature"
+func (c *Ctx) SendStatus(status int) error
+```
+
+```go title="Example"
+app.Get("/not-found", func(c *fiber.Ctx) error {
+ return c.SendStatus(415)
+ // => 415 "Unsupported Media Type"
+
+ c.SendString("Hello, World!")
+ return c.SendStatus(415)
+ // => 415 "Hello, World!"
+})
+```
+
+## Set
+
+Sets the response’s HTTP header field to the specified `key`, `value`.
+
+```go title="Signature"
+func (c *Ctx) Set(key string, val string)
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Set("Content-Type", "text/plain")
+ // => "Content-type: text/plain"
+
+ // ...
+})
+```
+
+## SetParserDecoder
+
+Allow you to config BodyParser/QueryParser decoder, base on schema's options, providing possibility to add custom type for parsing.
+
+```go title="Signature"
+func SetParserDecoder(parserConfig fiber.ParserConfig{
+ IgnoreUnknownKeys bool,
+ ParserType []fiber.ParserType{
+ Customtype interface{},
+ Converter func(string) reflect.Value,
+ },
+ ZeroEmpty bool,
+ SetAliasTag string,
+})
+```
+
+```go title="Example"
+
+type CustomTime time.Time
+
+// String() returns the time in string
+func (ct *CustomTime) String() string {
+ t := time.Time(*ct).String()
+ return t
+}
+
+// Register the converter for CustomTime type format as 2006-01-02
+var timeConverter = func(value string) reflect.Value {
+ fmt.Println("timeConverter", value)
+ if v, err := time.Parse("2006-01-02", value); err == nil {
+ return reflect.ValueOf(v)
+ }
+ return reflect.Value{}
+}
+
+customTime := fiber.ParserType{
+ Customtype: CustomTime{},
+ Converter: timeConverter,
+}
+
+// Add setting to the Decoder
+fiber.SetParserDecoder(fiber.ParserConfig{
+ IgnoreUnknownKeys: true,
+ ParserType: []fiber.ParserType{customTime},
+ ZeroEmpty: true,
+})
+
+// Example to use CustomType, you pause custom time format not in RFC3339
+type Demo struct {
+ Date CustomTime `form:"date" query:"date"`
+ Title string `form:"title" query:"title"`
+ Body string `form:"body" query:"body"`
+}
+
+app.Post("/body", func(c *fiber.Ctx) error {
+ var d Demo
+ c.BodyParser(&d)
+ fmt.Println("d.Date", d.Date.String())
+ return c.JSON(d)
+})
+
+app.Get("/query", func(c *fiber.Ctx) error {
+ var d Demo
+ c.QueryParser(&d)
+ fmt.Println("d.Date", d.Date.String())
+ return c.JSON(d)
+})
+
+// curl -X POST -F title=title -F body=body -F date=2021-10-20 http://localhost:3000/body
+
+// curl -X GET "http://localhost:3000/query?title=title&body=body&date=2021-10-20"
+
+```
+
+## SetUserContext
+
+Sets the user specified implementation for context interface.
+
+```go title="Signature"
+func (c *Ctx) SetUserContext(ctx context.Context)
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ ctx := context.Background()
+ c.SetUserContext(ctx)
+ // Here ctx could be any context implementation
+
+ // ...
+})
+```
+
+## Stale
+
+[https://expressjs.com/en/4x/api.html\#req.stale](https://expressjs.com/en/4x/api.html#req.stale)
+
+```go title="Signature"
+func (c *Ctx) Stale() bool
+```
+
+## Status
+
+Sets the HTTP status for the response.
+
+:::info
+Method is a **chainable**.
+:::
+
+```go title="Signature"
+func (c *Ctx) Status(status int) *Ctx
+```
+
+```go title="Example"
+app.Get("/fiber", func(c *fiber.Ctx) error {
+ c.Status(fiber.StatusOK)
+ return nil
+}
+
+app.Get("/hello", func(c *fiber.Ctx) error {
+ return c.Status(fiber.StatusBadRequest).SendString("Bad Request")
+}
+
+app.Get("/world", func(c *fiber.Ctx) error {
+ return c.Status(fiber.StatusNotFound).SendFile("./public/gopher.png")
+})
+```
+
+## Subdomains
+
+Returns a string slice of subdomains in the domain name of the request.
+
+The application property subdomain offset, which defaults to `2`, is used for determining the beginning of the subdomain segments.
+
+```go title="Signature"
+func (c *Ctx) Subdomains(offset ...int) []string
+```
+
+```go title="Example"
+// Host: "tobi.ferrets.example.com"
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Subdomains() // ["ferrets", "tobi"]
+ c.Subdomains(1) // ["tobi"]
+
+ // ...
+})
+```
+
+## Type
+
+Sets the [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) HTTP header to the MIME type listed [here](https://github.com/nginx/nginx/blob/master/conf/mime.types) specified by the file **extension**.
+
+```go title="Signature"
+func (c *Ctx) Type(ext string, charset ...string) *Ctx
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Type(".html") // => "text/html"
+ c.Type("html") // => "text/html"
+ c.Type("png") // => "image/png"
+
+ c.Type("json", "utf-8") // => "application/json; charset=utf-8"
+
+ // ...
+})
+```
+
+## UserContext
+
+UserContext returns a context implementation that was set by user earlier
+or returns a non-nil, empty context, if it was not set earlier.
+
+```go title="Signature"
+func (c *Ctx) UserContext() context.Context
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ ctx := c.UserContext()
+ // ctx is context implementation set by user
+
+ // ...
+})
+```
+
+## Vary
+
+Adds the given header field to the [Vary](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary) response header. This will append the header, if not already listed, otherwise leaves it listed in the current location.
+
+:::info
+Multiple fields are **allowed**.
+:::
+
+```go title="Signature"
+func (c *Ctx) Vary(fields ...string)
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Vary("Origin") // => Vary: Origin
+ c.Vary("User-Agent") // => Vary: Origin, User-Agent
+
+ // No duplicates
+ c.Vary("Origin") // => Vary: Origin, User-Agent
+
+ c.Vary("Accept-Encoding", "Accept")
+ // => Vary: Origin, User-Agent, Accept-Encoding, Accept
+
+ // ...
+})
+```
+
+## Write
+
+Write adopts the Writer interface
+
+```go title="Signature"
+func (c *Ctx) Write(p []byte) (n int, err error)
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.Write([]byte("Hello, World!")) // => "Hello, World!"
+
+ fmt.Fprintf(c, "%s\n", "Hello, World!") // "Hello, World!Hello, World!"
+})
+```
+
+## Writef
+
+Writef adopts the string with variables
+
+```go title="Signature"
+func (c *Ctx) Writef(f string, a ...interface{}) (n int, err error)
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ world := "World!"
+ c.Writef("Hello, %s", world) // => "Hello, World!"
+
+ fmt.Fprintf(c, "%s\n", "Hello, World!") // "Hello, World!Hello, World!"
+})
+```
+
+## WriteString
+
+WriteString adopts the string
+
+```go title="Signature"
+func (c *Ctx) WriteString(s string) (n int, err error)
+```
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ c.WriteString("Hello, World!") // => "Hello, World!"
+
+ fmt.Fprintf(c, "%s\n", "Hello, World!") // "Hello, World!Hello, World!"
+})
+```
+
+## XHR
+
+A Boolean property, that is `true`, if the request’s [X-Requested-With](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers) header field is [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest), indicating that the request was issued by a client library \(such as [jQuery](https://api.jquery.com/jQuery.ajax/)\).
+
+```go title="Signature"
+func (c *Ctx) XHR() bool
+```
+
+```go title="Example"
+// X-Requested-With: XMLHttpRequest
+
+app.Get("/", func(c *fiber.Ctx) error {
+ c.XHR() // true
+
+ // ...
+})
+```
+
+## XML
+
+Converts any **interface** or **string** to XML using the standard `encoding/xml` package.
+
+:::info
+XML also sets the content header to **application/xml**.
+:::
+
+```go title="Signature"
+func (c *Ctx) XML(data interface{}) error
+```
+
+```go title="Example"
+type SomeStruct struct {
+ XMLName xml.Name `xml:"Fiber"`
+ Name string `xml:"Name"`
+ Age uint8 `xml:"Age"`
+}
+
+app.Get("/", func(c *fiber.Ctx) error {
+ // Create data struct:
+ data := SomeStruct{
+ Name: "Grame",
+ Age: 20,
+ }
+
+ return c.XML(data)
+ //
+ // Grame
+ // 20
+ //
+})
+```
diff --git a/docs/api/fiber.md b/docs/api/fiber.md
new file mode 100644
index 0000000..1f9a91b
--- /dev/null
+++ b/docs/api/fiber.md
@@ -0,0 +1,120 @@
+---
+id: fiber
+title: 📦 Fiber
+description: Fiber represents the fiber package where you start to create an instance.
+sidebar_position: 1
+---
+
+## New
+
+This method creates a new **App** named instance. You can pass optional [config ](#config)when creating a new instance.
+
+```go title="Signature"
+func New(config ...Config) *App
+```
+
+```go title="Example"
+// Default config
+app := fiber.New()
+
+// ...
+```
+
+## Config
+
+You can pass an optional Config when creating a new Fiber instance.
+
+```go title="Example"
+// Custom config
+app := fiber.New(fiber.Config{
+ Prefork: true,
+ CaseSensitive: true,
+ StrictRouting: true,
+ ServerHeader: "Fiber",
+ AppName: "Test App v1.0.1",
+})
+
+// ...
+```
+
+**Config fields**
+
+| Property | Type | Description | Default |
+| ---------------------------- | --------------------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| --------------------- |
+| AppName | `string` | This allows to setup app name for the app | `""` |
+| BodyLimit | `int` | Sets the maximum allowed size for a request body, if the size exceeds the configured limit, it sends `413 - Request Entity Too Large` response. | `4 * 1024 * 1024` |
+| CaseSensitive | `bool` | When enabled, `/Foo` and `/foo` are different routes. When disabled, `/Foo`and `/foo` are treated the same. | `false` |
+| ColorScheme | [`Colors`](https://github.com/gofiber/fiber/blob/master/color.go) | You can define custom color scheme. They'll be used for startup message, route list and some middlewares. | [`DefaultColors`](https://github.com/gofiber/fiber/blob/master/color.go) |
+| CompressedFileSuffix | `string` | Adds a suffix to the original file name and tries saving the resulting compressed file under the new file name. | `".fiber.gz"` |
+| Concurrency | `int` | Maximum number of concurrent connections. | `256 * 1024` |
+| DisableDefaultContentType | `bool` | When set to true, causes the default Content-Type header to be excluded from the Response. | `false` |
+| DisableDefaultDate | `bool` | When set to true causes the default date header to be excluded from the response. | `false` |
+| DisableHeaderNormalizing | `bool` | By default all header names are normalized: conteNT-tYPE -> Content-Type | `false` |
+| DisableKeepalive | `bool` | Disable keep-alive connections, the server will close incoming connections after sending the first response to the client | `false` |
+| DisablePreParseMultipartForm | `bool` | Will not pre parse Multipart Form data if set to true. This option is useful for servers that desire to treat multipart form data as a binary blob, or choose when to parse the data. | `false` |
+| DisableStartupMessage | `bool` | When set to true, it will not print out debug information | `false` |
+| ETag | `bool` | Enable or disable ETag header generation, since both weak and strong etags are generated using the same hashing method \(CRC-32\). Weak ETags are the default when enabled. | `false` |
+| EnableIPValidation | `bool` | If set to true, `c.IP()` and `c.IPs()` will validate IP addresses before returning them. Also, `c.IP()` will return only the first valid IP rather than just the raw header value that may be a comma seperated string.
**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` |
+| EnableSplittingOnParsers | `bool` | EnableSplittingOnParsers splits the query/body/header parameters by comma when it's true.
For example, you can use it to parse multiple values from a query parameter like this: `/api?foo=bar,baz == foo[]=bar&foo[]=baz` | `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 0000000..9b741b1
--- /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 0000000..133ac51
--- /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 0000000..64df229
--- /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 0000000..d0f3609
--- /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 | `interface{}` | ContextUsername is the key to store the username in Locals. | `"username"` |
+| ContextPassword | `interface{}` | 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 0000000..e014694
--- /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("noCache") == "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 that is executed before creating the cache entry and can be used to execute the request without cache creation. If an entry already exists, it will be used. If you want to completely bypass the cache functionality in certain cases, you should use the [skip middleware](./skip.md). | `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 0000000..472f9d9
--- /dev/null
+++ b/docs/api/middleware/compress.md
@@ -0,0 +1,85 @@
+---
+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.
+
+:::note
+The compression middleware refrains from compressing bodies that are smaller than 200 bytes. This decision is based on the observation that, in such cases, the compressed size is likely to exceed the original size, making compression inefficient. [more](https://github.com/valyala/fasthttp/blob/497922a21ef4b314f393887e9c6147b8c3e3eda4/http.go#L1713-L1715)
+:::
+
+## 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 0000000..882a748
--- /dev/null
+++ b/docs/api/middleware/cors.md
@@ -0,0 +1,214 @@
+---
+id: cors
+---
+
+# CORS
+
+CORS (Cross-Origin Resource Sharing) is a middleware for [Fiber](https://github.com/gofiber/fiber) that allows servers to specify who can access its resources and how. It's not a security feature, but a way to relax the security model of web browsers for cross-origin requests. You can learn more about CORS on [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).
+
+This middleware works by adding CORS headers to responses from your Fiber application. These headers specify which origins, methods, and headers are allowed for cross-origin requests. It also handles preflight requests, which are a CORS mechanism to check if the actual request is safe to send.
+
+The middleware uses the `AllowOrigins` option to control which origins can make cross-origin requests. It supports single origin, multiple origins, subdomain matching, and wildcard origin. It also allows programmatic origin validation with the `AllowOriginsFunc` option.
+
+To ensure that the provided `AllowOrigins` origins are correctly formatted, this middleware validates and normalizes them. It checks for valid schemes, i.e., HTTP or HTTPS, and it will automatically remove trailing slashes. If the provided origin is invalid, the middleware will panic.
+
+When configuring CORS, it's important to avoid [common pitfalls](#common-pitfalls) like using a wildcard origin with credentials, being overly permissive with origins, and inadequate validation with `AllowOriginsFunc`. Misconfiguration can expose your application to various security risks.
+
+## 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:
+
+### Basic usage
+
+To use the default configuration, simply use `cors.New()`. This will allow wildcard origins '*', all methods, no credentials, and no headers or exposed headers.
+
+```go
+app.Use(cors.New())
+```
+
+### Custom configuration (specific origins, headers, etc.)
+
+```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",
+}))
+```
+
+### Dynamic origin validation
+
+You can use `AllowOriginsFunc` to programmatically determine whether to allow a request based on its origin. This is useful when you need to validate origins against a database or other dynamic sources. The function should return `true` if the origin is allowed, and `false` otherwise.
+
+Be sure to review the [security considerations](#security-considerations) when using `AllowOriginsFunc`.
+
+:::caution
+Never allow `AllowOriginsFunc` to return `true` for all origins. This is particularly crucial when `AllowCredentials` is set to `true`. Doing so can bypass the restriction of using a wildcard origin with credentials, exposing your application to serious security threats.
+
+If you need to allow wildcard origins, use `AllowOrigins` with a wildcard `"*"` instead of `AllowOriginsFunc`.
+:::
+
+```go
+// dbCheckOrigin checks if the origin is in the list of allowed origins in the database.
+func dbCheckOrigin(db *sql.DB, origin string) bool {
+ // Placeholder query - adjust according to your database schema and query needs
+ query := "SELECT COUNT(*) FROM allowed_origins WHERE origin = $1"
+
+ var count int
+ err := db.QueryRow(query, origin).Scan(&count)
+ if err != nil {
+ // Handle error (e.g., log it); for simplicity, we return false here
+ return false
+ }
+
+ return count > 0
+}
+
+// ...
+
+app.Use(cors.New(cors.Config{
+ AllowOriginsFunc: func(origin string) bool {
+ return dbCheckOrigin(db, origin)
+ },
+}))
+```
+
+### Prohibited usage
+
+The following example is prohibited because it can expose your application to security risks. It sets `AllowOrigins` to `"*"` (a wildcard) and `AllowCredentials` to `true`.
+
+```go
+app.Use(cors.New(cors.Config{
+ AllowOrigins: "*",
+ AllowCredentials: true,
+}))
+```
+
+This will result in the following panic:
+
+```
+panic: [CORS] 'AllowCredentials' is true, but 'AllowOrigins' cannot be set to `"*"`.
+```
+
+## 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` is a function that dynamically determines whether to allow a request based on its origin. If this function returns `true`, the 'Access-Control-Allow-Origin' response header will be set to the request's 'origin' header. This function is only used if the request's origin doesn't match any origin in `AllowOrigins`. | `nil` |
+| AllowOrigins | `string` | AllowOrigins defines a comma separated list of origins that may access the resource. This supports subdomain matching, so you can use a value like "https://*.example.com" to allow any subdomain of example.com to submit requests. | `"*"` |
+| AllowMethods | `string` | AllowMethods defines a list of 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. When used as part of a response to a preflight request, this indicates whether or not the actual request can be made using credentials. Note: If true, AllowOrigins cannot be set to a wildcard (`"*"`) to prevent security vulnerabilities. | `false` |
+| ExposeHeaders | `string` | ExposeHeaders defines 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. If you pass MaxAge 0, the Access-Control-Max-Age header will not be added and the browser will use 5 seconds by default. To disable caching completely, pass MaxAge value negative. It will set the Access-Control-Max-Age header to 0. | `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,
+}
+```
+
+## Subdomain Matching
+
+The `AllowOrigins` configuration supports matching subdomains at any level. This means you can use a value like `"https://*.example.com"` to allow any subdomain of `example.com` to submit requests, including multiple subdomain levels such as `"https://sub.sub.example.com"`.
+
+### Example
+
+If you want to allow CORS requests from any subdomain of `example.com`, including nested subdomains, you can configure the `AllowOrigins` like so:
+
+```go
+app.Use(cors.New(cors.Config{
+ AllowOrigins: "https://*.example.com",
+}))
+```
+
+# How It Works
+
+The CORS middleware works by adding the necessary CORS headers to responses from your Fiber application. These headers tell browsers what origins, methods, and headers are allowed for cross-origin requests.
+
+When a request comes in, the middleware first checks if it's a preflight request, which is a CORS mechanism to determine whether the actual request is safe to send. Preflight requests are HTTP OPTIONS requests with specific CORS headers. If it's a preflight request, the middleware responds with the appropriate CORS headers and ends the request.
+
+If it's not a preflight request, the middleware adds the CORS headers to the response and passes the request to the next handler. The actual CORS headers added depend on the configuration of the middleware.
+
+The `AllowOrigins` option controls which origins can make cross-origin requests. The middleware handles different `AllowOrigins` configurations as follows:
+
+- **Single origin:** If `AllowOrigins` is set to a single origin like `"http://www.example.com"`, and that origin matches the origin of the incoming request, the middleware adds the header `Access-Control-Allow-Origin: http://www.example.com` to the response.
+
+- **Multiple origins:** If `AllowOrigins` is set to multiple origins like `"https://example.com, https://www.example.com"`, the middleware picks the origin that matches the origin of the incoming request.
+
+- **Subdomain matching:** If `AllowOrigins` includes `"https://*.example.com"`, a subdomain like `https://sub.example.com` will be matched and `"https://sub.example.com"` will be the header. This will also match `https://sub.sub.example.com` and so on, but not `https://example.com`.
+
+- **Wildcard origin:** If `AllowOrigins` is set to `"*"`, the middleware uses that and adds the header `Access-Control-Allow-Origin: *` to the response.
+
+In all cases above, except the **Wildcard origin**, the middleware will either add the `Access-Control-Allow-Origin` header to the response matching the origin of the incoming request, or it will not add the header at all if the origin is not allowed.
+
+- **Programmatic origin validation:**: The middleware also handles the `AllowOriginsFunc` option, which allows you to programmatically determine if an origin is allowed. If `AllowOriginsFunc` returns `true` for an origin, the middleware sets the `Access-Control-Allow-Origin` header to that origin.
+
+The `AllowMethods` option controls which HTTP methods are allowed. For example, if `AllowMethods` is set to `"GET, POST"`, the middleware adds the header `Access-Control-Allow-Methods: GET, POST` to the response.
+
+The `AllowHeaders` option specifies which headers are allowed in the actual request. The middleware sets the Access-Control-Allow-Headers response header to the value of `AllowHeaders`. This informs the client which headers it can use in the actual request.
+
+The `AllowCredentials` option indicates whether the response to the request can be exposed when the credentials flag is true. If `AllowCredentials` is set to `true`, the middleware adds the header `Access-Control-Allow-Credentials: true` to the response. To prevent security vulnerabilities, `AllowCredentials` cannot be set to `true` if `AllowOrigins` is set to a wildcard (`*`).
+
+The `ExposeHeaders` option defines a whitelist of headers that clients are allowed to access. If `ExposeHeaders` is set to `"X-Custom-Header"`, the middleware adds the header `Access-Control-Expose-Headers: X-Custom-Header` to the response.
+
+The `MaxAge` option indicates how long the results of a preflight request can be cached. If `MaxAge` is set to `3600`, the middleware adds the header `Access-Control-Max-Age: 3600` to the response.
+
+The `Vary` header is used in this middleware to inform the client that the server's response to a request. For or both preflight and actual requests, the Vary header is set to `Access-Control-Request-Method` and `Access-Control-Request-Headers`. For preflight requests, the Vary header is also set to `Origin`. The `Vary` header is important for caching. It helps caches (like a web browser's cache or a CDN) determine when a cached response can be used in response to a future request, and when the server needs to be queried for a new response.
+
+## Security Considerations
+
+When configuring CORS, misconfiguration can potentially expose your application to various security risks. Here are some secure configurations and common pitfalls to avoid:
+
+### Secure Configurations
+
+- **Specify Allowed Origins**: Instead of using a wildcard (`"*"`), specify the exact domains allowed to make requests. For example, `AllowOrigins: "https://www.example.com, https://api.example.com"` ensures only these domains can make cross-origin requests to your application.
+
+- **Use Credentials Carefully**: If your application needs to support credentials in cross-origin requests, ensure `AllowCredentials` is set to `true` and specify exact origins in `AllowOrigins`. Do not use a wildcard origin in this case.
+
+- **Limit Exposed Headers**: Only whitelist headers that are necessary for the client-side application by setting `ExposeHeaders` appropriately. This minimizes the risk of exposing sensitive information.
+
+### Common Pitfalls
+
+- **Wildcard Origin with Credentials**: Setting `AllowOrigins` to `"*"` (a wildcard) and `AllowCredentials` to `true` is a common misconfiguration. This combination is prohibited because it can expose your application to security risks.
+
+- **Overly Permissive Origins**: Specifying too many origins or using overly broad patterns (e.g., `https://*.example.com`) can inadvertently allow malicious sites to interact with your application. Be as specific as possible with allowed origins.
+
+- **Inadequate `AllowOriginsFunc` Validation**: When using `AllowOriginsFunc` for dynamic origin validation, ensure the function includes robust checks to prevent unauthorized origins from being accepted. Overly permissive validation can lead to security vulnerabilities. Never allow `AllowOriginsFunc` to return `true` for all origins. This is particularly crucial when `AllowCredentials` is set to `true`. Doing so can bypass the restriction of using a wildcard origin with credentials, exposing your application to serious security threats. If you need to allow wildcard origins, use `AllowOrigins` with a wildcard `"*"` instead of `AllowOriginsFunc`.
+
+Remember, the key to secure CORS configuration is specificity and caution. By carefully selecting which origins, methods, and headers are allowed, you can help protect your application from cross-origin attacks.
\ No newline at end of file
diff --git a/docs/api/middleware/csrf.md b/docs/api/middleware/csrf.md
new file mode 100644
index 0000000..1ce4800
--- /dev/null
+++ b/docs/api/middleware/csrf.md
@@ -0,0 +1,256 @@
+---
+id: csrf
+---
+
+# CSRF
+
+The CSRF middleware for [Fiber](https://github.com/gofiber/fiber) provides protection against [Cross-Site Request Forgery](https://en.wikipedia.org/wiki/Cross-site_request_forgery) (CSRF) attacks. Requests made using methods other than those defined as 'safe' by [RFC9110#section-9.2.1](https://datatracker.ietf.org/doc/html/rfc9110.html#section-9.2.1) (GET, HEAD, OPTIONS, and TRACE) are validated using tokens. If a potential attack is detected, the middleware will return a default 403 Forbidden error.
+
+This middleware offers two [Token Validation Patterns](#token-validation-patterns): the [Double Submit Cookie Pattern (default)](#double-submit-cookie-pattern-default), and the [Synchronizer Token Pattern (with Session)](#synchronizer-token-pattern-with-session).
+
+As a [Defense In Depth](#defense-in-depth) measure, this middleware performs [Referer Checking](#referer-checking) for HTTPS requests.
+
+## Token Generation
+
+CSRF tokens are generated on 'safe' requests and when the existing token has expired or hasn't been set yet. If `SingleUseToken` is `true`, a new token is generated after each use. Retrieve the CSRF token using `c.Locals(contextKey)`, where `contextKey` is defined within the configuration.
+
+## Security Considerations
+
+This middleware is designed to protect against CSRF attacks but does not protect against other attack vectors, such as XSS. It should be used in combination with other security measures.
+
+:::danger
+Never use 'safe' methods to mutate data, for example, never use a GET request to modify a resource. This middleware will not protect against CSRF attacks on 'safe' methods.
+:::
+
+### Token Validation Patterns
+
+#### Double Submit Cookie Pattern (Default)
+
+By default, the middleware generates and stores tokens using the `fiber.Storage` interface. These tokens are not linked to any particular user session, and they are validated using the Double Submit Cookie pattern. The token is stored in a cookie, and then sent as a header on requests. The middleware compares the cookie value with the header value to validate the token. This is a secure pattern that does not require a user session.
+
+When the authorization status changes, the previously issued token MUST be deleted, and a new one generated. See [Token Lifecycle](#token-lifecycle) [Deleting Tokens](#deleting-tokens) for more information.
+
+:::caution
+When using this pattern, it's important to set the `CookieSameSite` option to `Lax` or `Strict` and ensure that the Extractor is not `CsrfFromCookie`, and KeyLookup is not `cookie:`.
+:::
+
+:::note
+When using this pattern, this middleware uses our [Storage](https://github.com/gofiber/storage) package to support various databases through a single interface. The default configuration for Storage saves data to memory. See [Custom Storage/Database](#custom-storagedatabase) for customizing the storage.
+:::
+
+#### Synchronizer Token Pattern (with Session)
+
+When using this middleware with a user session, the middleware can be configured to store the token within the session. This method is recommended when using a user session, as it is generally more secure than the Double Submit Cookie Pattern.
+
+When using this pattern it's important to regenerate the session when the authorization status changes, this will also delete the token. See: [Token Lifecycle](#token-lifecycle) for more information.
+
+:::caution
+Pre-sessions are required and will be created automatically if not present. Use a session value to indicate authentication instead of relying on presence of a session.
+:::
+
+### Defense In Depth
+
+When using this middleware, it's recommended to serve your pages over HTTPS, set the `CookieSecure` option to `true`, and set the `CookieSameSite` option to `Lax` or `Strict`. This ensures that the cookie is only sent over HTTPS and not on requests from external sites.
+
+:::note
+Cookie prefixes `__Host-` and `__Secure-` can be used to further secure the cookie. Note that these prefixes are not supported by all browsers and there are other limitations. See [MDN#Set-Cookie#cookie_prefixes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#cookie_prefixes) for more information.
+
+To use these prefixes, set the `CookieName` option to `__Host-csrf_` or `__Secure-csrf_`.
+:::
+
+### Referer Checking
+
+For HTTPS requests, this middleware performs strict referer checking. Even if a subdomain can set or modify cookies on your domain, it can't force a user to post to your application since that request won't come from your own exact domain.
+
+:::caution
+When HTTPS requests are protected by CSRF, referer checking is always carried out.
+
+The Referer header is automatically included in requests by all modern browsers, including those made using the JS Fetch API. However, if you're making use of this middleware with a custom client, it's important to ensure that the client sends a valid Referer header.
+:::
+
+
+### Token Lifecycle
+
+Tokens are valid until they expire or until they are deleted. By default, tokens are valid for 1 hour, and each subsequent request extends the expiration by 1 hour. The token only expires if the user doesn't make a request for the duration of the expiration time.
+
+#### Token Reuse
+
+By default, tokens may be used multiple times. If you want to delete the token after it has been used, you can set the `SingleUseToken` option to `true`. This will delete the token after it has been used, and a new token will be generated on the next request.
+
+:::info
+Using `SingleUseToken` comes with usability trade-offs and is not enabled by default. For example, it can interfere with the user experience if the user has multiple tabs open or uses the back button.
+:::
+
+#### Deleting Tokens
+
+When the authorization status changes, the CSRF token MUST be deleted, and a new one generated. This can be done by calling `handler.DeleteToken(c)`.
+
+```go
+if handler, ok := app.AcquireCtx(ctx).Locals(csrf.ConfigDefault.HandlerContextKey).(*CSRFHandler); ok {
+ if err := handler.DeleteToken(app.AcquireCtx(ctx)); err != nil {
+ // handle error
+ }
+}
+```
+
+:::tip
+If you are using this middleware with the fiber session middleware, then you can simply call `session.Destroy()`, `session.Regenerate()`, or `session.Reset()` to delete session and the token stored therein.
+:::
+
+### BREACH
+
+It's important to note that the token is sent as a header on every request. If you include the token in a page that is vulnerable to [BREACH](https://en.wikipedia.org/wiki/BREACH), an attacker may be able to extract the token. To mitigate this, ensure your pages are served over HTTPS, disable HTTP compression, and implement rate limiting for requests.
+
+## 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 initializing your Fiber app, you can use the following code to initialize the middleware:
+
+```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.UUIDv4,
+}))
+```
+
+## 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 "`:`" that is used to create an Extractor that extracts the token from the request. Possible values: "`header:`", "`query:`", "`param:`", "`form:`", "`cookie:`". Ignored if an Extractor is explicitly set. | "header:X-Csrf-Token" |
+| CookieName | `string` | Name of the csrf cookie. This cookie will store the csrf key. | "csrf_" |
+| CookieDomain | `string` | Domain of the CSRF cookie. | "" |
+| CookiePath | `string` | Path of the CSRF cookie. | "" |
+| CookieSecure | `bool` | Indicates if the CSRF cookie is secure. | false |
+| CookieHTTPOnly | `bool` | Indicates if the CSRF cookie is HTTP-only. | false |
+| CookieSameSite | `string` | Value of SameSite cookie. | "Lax" |
+| CookieSessionOnly | `bool` | Decides whether the cookie should last for only the browser session. Ignores Expiration if set to true. | false |
+| Expiration | `time.Duration` | Expiration is the duration before the CSRF token will expire. | 1 * time.Hour |
+| SingleUseToken | `bool` | SingleUseToken indicates if the CSRF token be destroyed and a new one generated on each use. (See TokenLifecycle) | false |
+| Storage | `fiber.Storage` | Store is used to store the state of the middleware. | `nil` |
+| Session | `*session.Store` | Session is used to store the state of the middleware. Overrides Storage if set. | `nil` |
+| SessionKey | `string` | SessionKey is the key used to store the token within the session. | "fiber.csrf.token" |
+| ContextKey | `inteface{}` | Context key to store the generated CSRF token into the context. If left empty, the token will not be stored within the context. | "" |
+| KeyGenerator | `func() string` | KeyGenerator creates a new CSRF token. | utils.UUID |
+| CookieExpires | `time.Duration` (Deprecated) | Deprecated: Please use Expiration. | 0 |
+| Cookie | `*fiber.Cookie` (Deprecated) | Deprecated: Please use Cookie* related fields. | `nil` |
+| TokenLookup | `string` (Deprecated) | Deprecated: Please use KeyLookup. | "" |
+| ErrorHandler | `fiber.ErrorHandler` | ErrorHandler is executed when an error is returned from fiber.Handler. | DefaultErrorHandler |
+| Extractor | `func(*fiber.Ctx) (string, error)` | Extractor returns the CSRF token. If set, this will be used in place of an Extractor based on KeyLookup. | Extractor based on KeyLookup |
+| HandlerContextKey | `interface{}` | HandlerContextKey is used to store the CSRF Handler into context. | "fiber.csrf.handler" |
+
+### Default Config
+
+```go
+var ConfigDefault = Config{
+ KeyLookup: "header:" + HeaderName,
+ CookieName: "csrf_",
+ CookieSameSite: "Lax",
+ Expiration: 1 * time.Hour,
+ KeyGenerator: utils.UUIDv4,
+ ErrorHandler: defaultErrorHandler,
+ Extractor: CsrfFromHeader(HeaderName),
+ SessionKey: "fiber.csrf.token",
+ HandlerContextKey: "fiber.csrf.handler",
+}
+```
+
+### Recommended Config (with session)
+
+It's recommended to use this middleware with [fiber/middleware/session](https://docs.gofiber.io/api/middleware/session) to store the CSRF token within the session. This is generally more secure than the default configuration.
+
+```go
+var ConfigDefault = Config{
+ KeyLookup: "header:" + HeaderName,
+ CookieName: "__Host-csrf_",
+ CookieSameSite: "Lax",
+ CookieSecure: true,
+ CookieSessionOnly: true,
+ CookieHTTPOnly: true,
+ Expiration: 1 * time.Hour,
+ KeyGenerator: utils.UUIDv4,
+ ErrorHandler: defaultErrorHandler,
+ Extractor: CsrfFromHeader(HeaderName),
+ Session: session.Store,
+ SessionKey: "fiber.csrf.token",
+ HandlerContextKey: "fiber.csrf.handler",
+}
+```
+
+## Constants
+
+```go
+const (
+ HeaderName = "X-Csrf-Token"
+)
+```
+
+## Sentinel Errors
+
+The CSRF middleware utilizes a set of sentinel errors to handle various scenarios and communicate errors effectively. These can be used within a [custom error handler](#custom-error-handler) to handle errors returned by the middleware.
+
+### Errors Returned to Error Handler
+
+- `ErrTokenNotFound`: Indicates that the CSRF token was not found.
+- `ErrTokenInvalid`: Indicates that the CSRF token is invalid.
+- `ErrNoReferer`: Indicates that the referer was not supplied.
+- `ErrBadReferer`: Indicates that the referer is invalid.
+
+If you use the default error handler, the client will receive a 403 Forbidden error without any additional information.
+
+## Custom Error Handler
+
+You can use a custom error handler to handle errors returned by the CSRF middleware. The error handler is executed when an error is returned from the middleware. The error handler is passed the error returned from the middleware and the fiber.Ctx.
+
+Example, returning a JSON response for API requests and rendering an error page for other requests:
+
+```go
+app.Use(csrf.New(csrf.Config{
+ ErrorHandler: func(c *fiber.Ctx, err error) error {
+ accepts := c.Accepts("html", "json")
+ path := c.Path()
+ if accepts == "json" || strings.HasPrefix(path, "/api/") {
+ return c.Status(fiber.StatusForbidden).JSON(fiber.Map{
+ "error": "Forbidden",
+ })
+ }
+ return c.Status(fiber.StatusForbidden).Render("error", fiber.Map{
+ "Title": "Forbidden",
+ "Status": fiber.StatusForbidden,
+ }, "layouts/main")
+ },
+}))
+```
+
+## Custom Storage/Database
+
+You can use any storage from our [storage](https://github.com/gofiber/storage/) package.
+
+```go
+storage := sqlite3.New() // From github.com/gofiber/storage/sqlite3
+app.Use(csrf.New(csrf.Config{
+ Storage: storage,
+}))
+```
diff --git a/docs/api/middleware/earlydata.md b/docs/api/middleware/earlydata.md
new file mode 100644
index 0000000..50e5bb1
--- /dev/null
+++ b/docs/api/middleware/earlydata.md
@@ -0,0 +1,82 @@
+---
+id: earlydata
+---
+
+# EarlyData
+
+The Early Data middleware for [Fiber](https://github.com/gofiber/fiber) adds support for TLS 1.3's early data ("0-RTT") feature.
+Citing [RFC 8446](https://datatracker.ietf.org/doc/html/rfc8446#section-2-3), when a client and server share a PSK, TLS 1.3 allows clients to send data on the first flight ("early data") to speed up the request, effectively reducing the regular 1-RTT request to a 0-RTT request.
+
+Make sure to enable fiber's `EnableTrustedProxyCheck` config option before using this middleware in order to not trust bogus HTTP request headers of the client.
+
+Also be aware that enabling support for early data in your reverse proxy (e.g. nginx, as done with a simple `ssl_early_data on;`) makes requests replayable. Refer to the following documents before continuing:
+
+- https://datatracker.ietf.org/doc/html/rfc8446#section-8
+- https://blog.trailofbits.com/2019/03/25/what-application-developers-need-to-know-about-tls-early-data-0rtt/
+
+By default, this middleware allows early data requests on safe HTTP request methods only and rejects the request otherwise, i.e. aborts the request before executing your handler. This behavior can be controlled by the `AllowEarlyData` config option.
+Safe HTTP methods — `GET`, `HEAD`, `OPTIONS` and `TRACE` — should not modify a state on the server.
+
+## 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/earlydata"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(earlydata.New())
+
+// Or extend your config for customization
+app.Use(earlydata.New(earlydata.Config{
+ Error: fiber.ErrTooEarly,
+ // ...
+}))
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:---------------|:------------------------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| IsEarlyData | `func(*fiber.Ctx) bool` | IsEarlyData returns whether the request is an early-data request. | Function checking if "Early-Data" header equals "1" |
+| AllowEarlyData | `func(*fiber.Ctx) bool` | AllowEarlyData returns whether the early-data request should be allowed or rejected. | Function rejecting on unsafe and allowing safe methods |
+| Error | `error` | Error is returned in case an early-data request is rejected. | `fiber.ErrTooEarly` |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ IsEarlyData: func(c *fiber.Ctx) bool {
+ return c.Get(DefaultHeaderName) == DefaultHeaderTrueValue
+ },
+
+ AllowEarlyData: func(c *fiber.Ctx) bool {
+ return fiber.IsMethodSafe(c.Method())
+ },
+
+ Error: fiber.ErrTooEarly,
+}
+```
+
+## Constants
+
+```go
+const (
+ DefaultHeaderName = "Early-Data"
+ DefaultHeaderTrueValue = "1"
+)
+```
diff --git a/docs/api/middleware/encryptcookie.md b/docs/api/middleware/encryptcookie.md
new file mode 100644
index 0000000..c6e689e
--- /dev/null
+++ b/docs/api/middleware/encryptcookie.md
@@ -0,0 +1,101 @@
+---
+id: encryptcookie
+---
+
+# Encrypt Cookie
+
+Encrypt Cookie is a middleware for [Fiber](https://github.com/gofiber/fiber) that secures your cookie values through encryption.
+
+:::note
+This middleware encrypts cookie values and not the cookie names.
+:::
+
+## Signatures
+
+```go
+// Intitializes the middleware
+func New(config ...Config) fiber.Handler
+
+// Returns a random 32 character long string
+func GenerateKey() string
+```
+
+## Examples
+
+To use the Encrypt Cookie middleware, first, import the middleware package as part of the Fiber web framework:
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/encryptcookie"
+)
+```
+
+Once you've imported the middleware package, you can use it inside your Fiber app:
+
+```go
+// Provide a minimal configuration
+app.Use(encryptcookie.New(encryptcookie.Config{
+ Key: "secret-thirty-2-character-string",
+}))
+
+// Retrieve the encrypted cookie value
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("value=" + c.Cookies("test"))
+})
+
+// Create an encrypted cookie
+app.Post("/", func(c *fiber.Ctx) error {
+ c.Cookie(&fiber.Cookie{
+ Name: "test",
+ Value: "SomeThing",
+ })
+ return nil
+})
+```
+
+:::note
+`Key` must be a 32 character string. It's used to encrypt the values, so make sure it is random and keep it secret.
+You can run `openssl rand -base64 32` or call `encryptcookie.GenerateKey()` to create a random key for you.
+Make sure not to set `Key` to `encryptcookie.GenerateKey()` because that will create a new key every run.
+:::
+
+## Config
+
+| Property | Type | Description | Default |
+|:----------|:----------------------------------------------------|:------------------------------------------------------------------------------------------------------|:-----------------------------|
+| Next | `func(*fiber.Ctx) bool` | A function to skip this middleware when returned true. | `nil` |
+| Except | `[]string` | Array of cookie keys that should not be encrypted. | `[]` |
+| Key | `string` | A base64-encoded unique key to encode & decode cookies. Required. Key length should be 32 characters. | (No default, required field) |
+| Encryptor | `func(decryptedString, key string) (string, error)` | A custom function to encrypt cookies. | `EncryptCookie` |
+| Decryptor | `func(encryptedString, key string) (string, error)` | A custom function to decrypt cookies. | `DecryptCookie` |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ Except: []string{},
+ Key: "",
+ Encryptor: EncryptCookie,
+ Decryptor: DecryptCookie,
+}
+```
+
+## Usage With Other Middlewares That Reads Or Modify Cookies
+Place the encryptcookie middleware before any other middleware that reads or modifies cookies. For example, if you are using the CSRF middleware, ensure that the encryptcookie middleware is placed before it. Failure to do so may prevent the CSRF middleware from reading the encrypted cookie.
+
+You may also choose to exclude certain cookies from encryption. For instance, if you are using the CSRF middleware with a frontend framework like Angular, and the framework reads the token from a cookie, you should exclude that cookie from encryption. This can be achieved by adding the cookie name to the Except array in the configuration:
+
+```go
+app.Use(encryptcookie.New(encryptcookie.Config{
+ Key: "secret-thirty-2-character-string",
+ Except: []string{csrf.ConfigDefault.CookieName}, // exclude CSRF cookie
+}))
+app.Use(csrf.New(csrf.Config{
+ KeyLookup: "header:" + csrf.HeaderName,
+ CookieSameSite: "Lax",
+ CookieSecure: true,
+ CookieHTTPOnly: false,
+}))
+```
diff --git a/docs/api/middleware/envvar.md b/docs/api/middleware/envvar.md
new file mode 100644
index 0000000..1d9f474
--- /dev/null
+++ b/docs/api/middleware/envvar.md
@@ -0,0 +1,69 @@
+---
+id: envvar
+---
+
+# EnvVar
+
+EnvVar middleware for [Fiber](https://github.com/gofiber/fiber) that can be used to expose environment variables 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/envvar"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use("/expose/envvars", envvar.New())
+
+// Or extend your config for customization
+app.Use("/expose/envvars", envvar.New(
+ envvar.Config{
+ ExportVars: map[string]string{"testKey": "", "testDefaultKey": "testDefaultVal"},
+ ExcludeVars: map[string]string{"excludeKey": ""},
+ }),
+)
+```
+
+:::note
+You will need to provide a path to use the envvar middleware.
+:::
+
+## Response
+
+Http response contract:
+```
+{
+ "vars": {
+ "someEnvVariable": "someValue",
+ "anotherEnvVariable": "anotherValue",
+ }
+}
+
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:------------|:--------------------|:-----------------------------------------------------------------------------|:--------|
+| ExportVars | `map[string]string` | ExportVars specifies the environment variables that should be exported. | `nil` |
+| ExcludeVars | `map[string]string` | ExcludeVars specifies the environment variables that should not be exported. | `nil` |
+
+## Default Config
+
+```go
+Config{}
+```
diff --git a/docs/api/middleware/etag.md b/docs/api/middleware/etag.md
new file mode 100644
index 0000000..24be273
--- /dev/null
+++ b/docs/api/middleware/etag.md
@@ -0,0 +1,62 @@
+---
+id: etag
+---
+
+# ETag
+
+ETag middleware for [Fiber](https://github.com/gofiber/fiber) that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.
+
+## 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/etag"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(etag.New())
+
+// Get / receives Etag: "13-1831710635" in response header
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World!")
+})
+
+// Or extend your config for customization
+app.Use(etag.New(etag.Config{
+ Weak: true,
+}))
+
+// Get / receives Etag: "W/"13-1831710635" in response header
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World!")
+})
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:---------|:------------------------|:-------------------------------------------------------------------------------------------------------------------|:--------|
+| Weak | `bool` | Weak indicates that a weak validator is used. Weak etags are easy to generate but are less useful for comparisons. | `false` |
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ Weak: false,
+}
+```
diff --git a/docs/api/middleware/expvar.md b/docs/api/middleware/expvar.md
new file mode 100644
index 0000000..900850e
--- /dev/null
+++ b/docs/api/middleware/expvar.md
@@ -0,0 +1,72 @@
+---
+id: expvar
+---
+
+# ExpVar
+
+Expvar middleware for [Fiber](https://github.com/gofiber/fiber) that serves via its HTTP server runtime exposed variants in the JSON format. The package is typically only imported for the side effect of registering its HTTP handlers. The handled path is `/debug/vars`.
+
+## Signatures
+
+```go
+func New() fiber.Handler
+```
+
+## Examples
+
+Import the middleware package that is part of the Fiber web framework
+
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ expvarmw "github.com/gofiber/fiber/v2/middleware/expvar"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+```go
+var count = expvar.NewInt("count")
+
+app.Use(expvarmw.New())
+app.Get("/", func(c *fiber.Ctx) error {
+ count.Add(1)
+
+ return c.SendString(fmt.Sprintf("hello expvar count %d", count.Value()))
+})
+```
+
+Visit path `/debug/vars` to see all vars and use query `r=key` to filter exposed variables.
+
+```bash
+curl 127.0.0.1:3000
+hello expvar count 1
+
+curl 127.0.0.1:3000/debug/vars
+{
+ "cmdline": ["xxx"],
+ "count": 1,
+ "expvarHandlerCalls": 33,
+ "expvarRegexpErrors": 0,
+ "memstats": {...}
+}
+
+curl 127.0.0.1:3000/debug/vars?r=c
+{
+ "cmdline": ["xxx"],
+ "count": 1
+}
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:---------|:------------------------|:--------------------------------------------------------------------|:--------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+}
+```
diff --git a/docs/api/middleware/favicon.md b/docs/api/middleware/favicon.md
new file mode 100644
index 0000000..b1a9b0d
--- /dev/null
+++ b/docs/api/middleware/favicon.md
@@ -0,0 +1,63 @@
+---
+id: favicon
+---
+
+# Favicon
+
+Favicon middleware for [Fiber](https://github.com/gofiber/fiber) that ignores favicon requests or caches a provided icon in memory to improve performance by skipping disk access. User agents request favicon.ico frequently and indiscriminately, so you may wish to exclude these requests from your logs by using this middleware before your logger middleware.
+
+:::note
+This middleware is exclusively for serving the default, implicit favicon, which is GET /favicon.ico or [custom favicon URL](#config).
+:::
+
+## 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/favicon"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(favicon.New())
+
+// Or extend your config for customization
+app.Use(favicon.New(favicon.Config{
+ File: "./favicon.ico",
+ URL: "/favicon.ico",
+}))
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:-------------|:------------------------|:---------------------------------------------------------------------------------|:---------------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| Data | `[]byte` | Raw data of the favicon file. This can be used instead of `File`. | `nil` |
+| File | `string` | File holds the path to an actual favicon that will be cached. | "" |
+| URL | `string` | URL for favicon handler. | "/favicon.ico" |
+| FileSystem | `http.FileSystem` | FileSystem is an optional alternate filesystem to search for the favicon in. | `nil` |
+| CacheControl | `string` | CacheControl defines how the Cache-Control header in the response should be set. | "public, max-age=31536000" |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ File: "",
+ URL: fPath,
+ CacheControl: "public, max-age=31536000",
+}
+```
diff --git a/docs/api/middleware/filesystem.md b/docs/api/middleware/filesystem.md
new file mode 100644
index 0000000..bbeff14
--- /dev/null
+++ b/docs/api/middleware/filesystem.md
@@ -0,0 +1,300 @@
+---
+id: filesystem
+---
+
+# FileSystem
+
+Filesystem middleware for [Fiber](https://github.com/gofiber/fiber) that enables you to serve files from a directory.
+
+:::caution
+**`:params` & `:optionals?` within the prefix path are not supported!**
+
+**To handle paths with spaces (or other url encoded values) make sure to set `fiber.Config{ UnescapePath: true }`**
+:::
+
+## 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/filesystem"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Provide a minimal config
+app.Use(filesystem.New(filesystem.Config{
+ Root: http.Dir("./assets"),
+}))
+
+// Or extend your config for customization
+app.Use(filesystem.New(filesystem.Config{
+ Root: http.Dir("./assets"),
+ Browse: true,
+ Index: "index.html",
+ NotFoundFile: "404.html",
+ MaxAge: 3600,
+}))
+```
+
+
+> If your environment (Go 1.16+) supports it, we recommend using Go Embed instead of the other solutions listed as this one is native to Go and the easiest to use.
+
+## embed
+
+[Embed](https://golang.org/pkg/embed/) is the native method to embed files in a Golang excecutable. Introduced in Go 1.16.
+
+```go
+package main
+
+import (
+ "embed"
+ "io/fs"
+ "log"
+ "net/http"
+
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/filesystem"
+)
+
+// Embed a single file
+//go:embed index.html
+var f embed.FS
+
+// Embed a directory
+//go:embed static/*
+var embedDirStatic embed.FS
+
+func main() {
+ app := fiber.New()
+
+ app.Use("/", filesystem.New(filesystem.Config{
+ Root: http.FS(f),
+ }))
+
+ // Access file "image.png" under `static/` directory via URL: `http:///static/image.png`.
+ // Without `PathPrefix`, you have to access it via URL:
+ // `http:///static/static/image.png`.
+ app.Use("/static", filesystem.New(filesystem.Config{
+ Root: http.FS(embedDirStatic),
+ PathPrefix: "static",
+ Browse: true,
+ }))
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+## pkger
+
+[https://github.com/markbates/pkger](https://github.com/markbates/pkger)
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/filesystem"
+
+ "github.com/markbates/pkger"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Use("/assets", filesystem.New(filesystem.Config{
+ Root: pkger.Dir("/assets"),
+ }))
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+## packr
+
+[https://github.com/gobuffalo/packr](https://github.com/gobuffalo/packr)
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/filesystem"
+
+ "github.com/gobuffalo/packr/v2"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Use("/assets", filesystem.New(filesystem.Config{
+ Root: packr.New("Assets Box", "/assets"),
+ }))
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+## go.rice
+
+[https://github.com/GeertJohan/go.rice](https://github.com/GeertJohan/go.rice)
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/filesystem"
+
+ "github.com/GeertJohan/go.rice"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Use("/assets", filesystem.New(filesystem.Config{
+ Root: rice.MustFindBox("assets").HTTPBox(),
+ }))
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+## fileb0x
+
+[https://github.com/UnnoTed/fileb0x](https://github.com/UnnoTed/fileb0x)
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/filesystem"
+
+ "/myEmbeddedFiles"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Use("/assets", filesystem.New(filesystem.Config{
+ Root: myEmbeddedFiles.HTTP,
+ }))
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+## statik
+
+[https://github.com/rakyll/statik](https://github.com/rakyll/statik)
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/filesystem"
+
+ // Use blank to invoke init function and register data to statik
+ _ "/statik"
+ "github.com/rakyll/statik/fs"
+)
+
+func main() {
+ statikFS, err := fs.New()
+ if err != nil {
+ panic(err)
+ }
+
+ app := fiber.New()
+
+ app.Use("/", filesystem.New(filesystem.Config{
+ Root: statikFS,
+ }))
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:-------------------|:------------------------|:------------------------------------------------------------------------------------------------------------|:-------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| Root | `http.FileSystem` | Root is a FileSystem that provides access to a collection of files and directories. | `nil` |
+| PathPrefix | `string` | PathPrefix defines a prefix to be added to a filepath when reading a file from the FileSystem. | "" |
+| Browse | `bool` | Enable directory browsing. | `false` |
+| Index | `string` | Index file for serving a directory. | "index.html" |
+| MaxAge | `int` | The value for the Cache-Control HTTP-header that is set on the file response. MaxAge is defined in seconds. | 0 |
+| NotFoundFile | `string` | File to return if the path is not found. Useful for SPA's. | "" |
+| ContentTypeCharset | `string` | The value for the Content-Type HTTP-header that is set on the file response. | "" |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ Root: nil,
+ PathPrefix: "",
+ Browse: false,
+ Index: "/index.html",
+ MaxAge: 0,
+ ContentTypeCharset: "",
+}
+```
+
+## Utils
+
+### SendFile
+
+Serves a file from an [HTTP file system](https://pkg.go.dev/net/http#FileSystem) at the specified path.
+
+```go title="Signature" title="Signature"
+func SendFile(c *fiber.Ctx, filesystem http.FileSystem, path string) error
+```
+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/filesystem"
+)
+```
+
+```go title="Example"
+// Define a route to serve a specific file
+app.Get("/download", func(c *fiber.Ctx) error {
+ // Serve the file using SendFile function
+ err := filesystem.SendFile(c, http.Dir("your/filesystem/root"), "path/to/your/file.txt")
+ if err != nil {
+ // Handle the error, e.g., return a 404 Not Found response
+ return c.Status(fiber.StatusNotFound).SendString("File not found")
+ }
+
+ return nil
+})
+```
+
+```go title="Example"
+// Serve static files from the "build" directory using Fiber's built-in middleware.
+app.Use("/", filesystem.New(filesystem.Config{
+ Root: http.FS(f), // Specify the root directory for static files.
+ PathPrefix: "build", // Define the path prefix where static files are served.
+}))
+
+// For all other routes (wildcard "*"), serve the "index.html" file from the "build" directory.
+app.Use("*", func(ctx *fiber.Ctx) error {
+ return filesystem.SendFile(ctx, http.FS(f), "build/index.html")
+})
+```
diff --git a/docs/api/middleware/healthcheck.md b/docs/api/middleware/healthcheck.md
new file mode 100644
index 0000000..641c236
--- /dev/null
+++ b/docs/api/middleware/healthcheck.md
@@ -0,0 +1,106 @@
+---
+id: healthcheck
+---
+
+# Health Check
+
+Liveness and readiness probes middleware for [Fiber](https://github.com/gofiber/fiber) that provides two endpoints for checking the liveness and readiness state of HTTP applications.
+
+## Overview
+
+- **Liveness Probe**: Checks if the server is up and running.
+ - **Default Endpoint**: `/livez`
+ - **Behavior**: By default returns `true` immediately when the server is operational.
+
+- **Readiness Probe**: Assesses if the application is ready to handle requests.
+ - **Default Endpoint**: `/readyz`
+ - **Behavior**: By default returns `true` immediately when the server is operational.
+
+- **HTTP Status Codes**:
+ - `200 OK`: Returned when the checker function evaluates to `true`.
+ - `503 Service Unavailable`: Returned when the checker function evaluates to `false`.
+
+## Signatures
+
+```go
+func New(config Config) fiber.Handler
+```
+
+## Examples
+
+Import the middleware package that is part of the [Fiber](https://github.com/gofiber/fiber) web framework
+```go
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/healthcheck"
+)
+```
+
+After you initiate your [Fiber](https://github.com/gofiber/fiber) app, you can use the following possibilities:
+
+```go
+// Provide a minimal config
+app.Use(healthcheck.New())
+
+// Or extend your config for customization
+app.Use(healthcheck.New(healthcheck.Config{
+ LivenessProbe: func(c *fiber.Ctx) bool {
+ return true
+ },
+ LivenessEndpoint: "/live",
+ ReadinessProbe: func(c *fiber.Ctx) bool {
+ return serviceA.Ready() && serviceB.Ready() && ...
+ },
+ ReadinessEndpoint: "/ready",
+}))
+```
+
+## Config
+
+```go
+type Config struct {
+ // Next defines a function to skip this middleware when returned true.
+ //
+ // Optional. Default: nil
+ Next func(c *fiber.Ctx) bool
+
+ // Function used for checking the liveness of the application. Returns true if the application
+ // is running and false if it is not. The liveness probe is typically used to indicate if
+ // the application is in a state where it can handle requests (e.g., the server is up and running).
+ //
+ // Optional. Default: func(c *fiber.Ctx) bool { return true }
+ LivenessProbe HealthChecker
+
+ // HTTP endpoint at which the liveness probe will be available.
+ //
+ // Optional. Default: "/livez"
+ LivenessEndpoint string
+
+ // Function used for checking the readiness of the application. Returns true if the application
+ // is ready to process requests and false otherwise. The readiness probe typically checks if all necessary
+ // services, databases, and other dependencies are available for the application to function correctly.
+ //
+ // Optional. Default: func(c *fiber.Ctx) bool { return true }
+ ReadinessProbe HealthChecker
+
+ // HTTP endpoint at which the readiness probe will be available.
+ // Optional. Default: "/readyz"
+ ReadinessEndpoint string
+}
+```
+
+## Default Config
+
+The default configuration used by this middleware is defined as follows:
+```go
+func defaultLivenessProbe(*fiber.Ctx) bool { return true }
+
+func defaultReadinessProbe(*fiber.Ctx) bool { return true }
+
+var ConfigDefault = Config{
+ LivenessProbe: defaultLivenessProbe,
+ ReadinessProbe: defaultReadinessProbe,
+ LivenessEndpoint: "/livez",
+ ReadinessEndpoint: "/readyz",
+}
+```
diff --git a/docs/api/middleware/helmet.md b/docs/api/middleware/helmet.md
new file mode 100644
index 0000000..0835f31
--- /dev/null
+++ b/docs/api/middleware/helmet.md
@@ -0,0 +1,82 @@
+---
+id: helmet
+---
+
+# Helmet
+
+Helmet middleware helps secure your apps by setting various HTTP headers.
+
+## Signatures
+
+```go
+func New(config ...Config) fiber.Handler
+```
+
+## Examples
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/helmet"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Use(helmet.New())
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Welcome!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+**Test:**
+
+```curl
+curl -I http://localhost:3000
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:--------------------------|:------------------------|:--------------------------------------------|:-----------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip middleware. | `nil` |
+| XSSProtection | `string` | XSSProtection | "0" |
+| ContentTypeNosniff | `string` | ContentTypeNosniff | "nosniff" |
+| XFrameOptions | `string` | XFrameOptions | "SAMEORIGIN" |
+| HSTSMaxAge | `int` | HSTSMaxAge | 0 |
+| HSTSExcludeSubdomains | `bool` | HSTSExcludeSubdomains | false |
+| ContentSecurityPolicy | `string` | ContentSecurityPolicy | "" |
+| CSPReportOnly | `bool` | CSPReportOnly | false |
+| HSTSPreloadEnabled | `bool` | HSTSPreloadEnabled | false |
+| ReferrerPolicy | `string` | ReferrerPolicy | "ReferrerPolicy" |
+| PermissionPolicy | `string` | Permissions-Policy | "" |
+| CrossOriginEmbedderPolicy | `string` | Cross-Origin-Embedder-Policy | "require-corp" |
+| CrossOriginOpenerPolicy | `string` | Cross-Origin-Opener-Policy | "same-origin" |
+| CrossOriginResourcePolicy | `string` | Cross-Origin-Resource-Policy | "same-origin" |
+| OriginAgentCluster | `string` | Origin-Agent-Cluster | "?1" |
+| XDNSPrefetchControl | `string` | X-DNS-Prefetch-Control | "off" |
+| XDownloadOptions | `string` | X-Download-Options | "noopen" |
+| XPermittedCrossDomain | `string` | X-Permitted-Cross-Domain-Policies | "none" |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ XSSProtection: "0",
+ ContentTypeNosniff: "nosniff",
+ XFrameOptions: "SAMEORIGIN",
+ ReferrerPolicy: "no-referrer",
+ CrossOriginEmbedderPolicy: "require-corp",
+ CrossOriginOpenerPolicy: "same-origin",
+ CrossOriginResourcePolicy: "same-origin",
+ OriginAgentCluster: "?1",
+ XDNSPrefetchControl: "off",
+ XDownloadOptions: "noopen",
+ XPermittedCrossDomain: "none",
+}
+```
diff --git a/docs/api/middleware/idempotency.md b/docs/api/middleware/idempotency.md
new file mode 100644
index 0000000..bab7c0e
--- /dev/null
+++ b/docs/api/middleware/idempotency.md
@@ -0,0 +1,83 @@
+---
+id: idempotency
+---
+
+# Idempotency
+
+Idempotency middleware for [Fiber](https://github.com/gofiber/fiber) allows for fault-tolerant APIs where duplicate requests — for example due to networking issues on the client-side — do not erroneously cause the same action performed multiple times on the server-side.
+
+Refer to https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-idempotency-key-header-02 for a better understanding.
+
+## 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/idempotency"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+### Default Config
+
+```go
+app.Use(idempotency.New())
+```
+
+### Custom Config
+
+```go
+app.Use(idempotency.New(idempotency.Config{
+ Lifetime: 42 * time.Minute,
+ // ...
+}))
+```
+
+### Config
+
+| Property | Type | Description | Default |
+|:--------------------|:------------------------|:-----------------------------------------------------------------------------------------|:-------------------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | A function for safe methods |
+| Lifetime | `time.Duration` | Lifetime is the maximum lifetime of an idempotency key. | 30 * time.Minute |
+| KeyHeader | `string` | KeyHeader is the name of the header that contains the idempotency key. | "X-Idempotency-Key" |
+| KeyHeaderValidate | `func(string) error` | KeyHeaderValidate defines a function to validate the syntax of the idempotency header. | A function for UUID validation |
+| KeepResponseHeaders | `[]string` | KeepResponseHeaders is a list of headers that should be kept from the original response. | nil (keep all headers) |
+| Lock | `Locker` | Lock locks an idempotency key. | An in-memory locker |
+| Storage | `fiber.Storage` | Storage stores response data by idempotency key. | An in-memory storage |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: func(c *fiber.Ctx) bool {
+ // Skip middleware if the request was done using a safe HTTP method
+ return fiber.IsMethodSafe(c.Method())
+ },
+
+ Lifetime: 30 * time.Minute,
+
+ KeyHeader: "X-Idempotency-Key",
+ KeyHeaderValidate: func(k string) error {
+ if l, wl := len(k), 36; l != wl { // UUID length is 36 chars
+ return fmt.Errorf("%w: invalid length: %d != %d", ErrInvalidIdempotencyKey, l, wl)
+ }
+
+ return nil
+ },
+
+ KeepResponseHeaders: nil,
+
+ Lock: nil, // Set in configDefault so we don't allocate data here.
+
+ Storage: nil, // Set in configDefault so we don't allocate data here.
+}
+```
diff --git a/docs/api/middleware/keyauth.md b/docs/api/middleware/keyauth.md
new file mode 100644
index 0000000..4705c2e
--- /dev/null
+++ b/docs/api/middleware/keyauth.md
@@ -0,0 +1,243 @@
+---
+id: keyauth
+---
+
+# Keyauth
+
+Key auth middleware provides a key based authentication.
+
+## Signatures
+
+```go
+func New(config ...Config) fiber.Handler
+```
+
+## Examples
+
+```go
+package main
+
+import (
+ "crypto/sha256"
+ "crypto/subtle"
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/keyauth"
+)
+
+var (
+ apiKey = "correct horse battery staple"
+)
+
+func validateAPIKey(c *fiber.Ctx, key string) (bool, error) {
+ hashedAPIKey := sha256.Sum256([]byte(apiKey))
+ hashedKey := sha256.Sum256([]byte(key))
+
+ if subtle.ConstantTimeCompare(hashedAPIKey[:], hashedKey[:]) == 1 {
+ return true, nil
+ }
+ return false, keyauth.ErrMissingOrMalformedAPIKey
+}
+
+func main() {
+ app := fiber.New()
+
+ // note that the keyauth middleware needs to be defined before the routes are defined!
+ app.Use(keyauth.New(keyauth.Config{
+ KeyLookup: "cookie:access_token",
+ Validator: validateAPIKey,
+ }))
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Successfully authenticated!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+**Test:**
+
+```bash
+# No api-key specified -> 400 missing
+curl http://localhost:3000
+#> missing or malformed API Key
+
+curl --cookie "access_token=correct horse battery staple" http://localhost:3000
+#> Successfully authenticated!
+
+curl --cookie "access_token=Clearly A Wrong Key" http://localhost:3000
+#> missing or malformed API Key
+```
+
+For a more detailed example, see also the [`github.com/gofiber/recipes`](https://github.com/gofiber/recipes) repository and specifically the `fiber-envoy-extauthz` repository and the [`keyauth example`](https://github.com/gofiber/recipes/blob/master/fiber-envoy-extauthz/authz/main.go) code.
+
+
+### Authenticate only certain endpoints
+
+If you want to authenticate only certain endpoints, you can use the `Config` of keyauth and apply a filter function (eg. `authFilter`) like so
+
+```go
+package main
+
+import (
+ "crypto/sha256"
+ "crypto/subtle"
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/keyauth"
+ "regexp"
+ "strings"
+)
+
+var (
+ apiKey = "correct horse battery staple"
+ protectedURLs = []*regexp.Regexp{
+ regexp.MustCompile("^/authenticated$"),
+ regexp.MustCompile("^/auth2$"),
+ }
+)
+
+func validateAPIKey(c *fiber.Ctx, key string) (bool, error) {
+ hashedAPIKey := sha256.Sum256([]byte(apiKey))
+ hashedKey := sha256.Sum256([]byte(key))
+
+ if subtle.ConstantTimeCompare(hashedAPIKey[:], hashedKey[:]) == 1 {
+ return true, nil
+ }
+ return false, keyauth.ErrMissingOrMalformedAPIKey
+}
+
+func authFilter(c *fiber.Ctx) bool {
+ originalURL := strings.ToLower(c.OriginalURL())
+
+ for _, pattern := range protectedURLs {
+ if pattern.MatchString(originalURL) {
+ return false
+ }
+ }
+ return true
+}
+
+func main() {
+ app := fiber.New()
+
+ app.Use(keyauth.New(keyauth.Config{
+ Next: authFilter,
+ KeyLookup: "cookie:access_token",
+ Validator: validateAPIKey,
+ }))
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Welcome")
+ })
+ app.Get("/authenticated", func(c *fiber.Ctx) error {
+ return c.SendString("Successfully authenticated!")
+ })
+ app.Get("/auth2", func(c *fiber.Ctx) error {
+ return c.SendString("Successfully authenticated 2!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+Which results in this
+
+```bash
+# / does not need to be authenticated
+curl http://localhost:3000
+#> Welcome
+
+# /authenticated needs to be authenticated
+curl --cookie "access_token=correct horse battery staple" http://localhost:3000/authenticated
+#> Successfully authenticated!
+
+# /auth2 needs to be authenticated too
+curl --cookie "access_token=correct horse battery staple" http://localhost:3000/auth2
+#> Successfully authenticated 2!
+```
+
+### Specifying middleware in the handler
+
+```go
+package main
+
+import (
+ "crypto/sha256"
+ "crypto/subtle"
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/keyauth"
+)
+
+const (
+ apiKey = "my-super-secret-key"
+)
+
+func main() {
+ app := fiber.New()
+
+ authMiddleware := keyauth.New(keyauth.Config{
+ Validator: func(c *fiber.Ctx, key string) (bool, error) {
+ hashedAPIKey := sha256.Sum256([]byte(apiKey))
+ hashedKey := sha256.Sum256([]byte(key))
+
+ if subtle.ConstantTimeCompare(hashedAPIKey[:], hashedKey[:]) == 1 {
+ return true, nil
+ }
+ return false, keyauth.ErrMissingOrMalformedAPIKey
+ },
+ })
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Welcome")
+ })
+
+ app.Get("/allowed", authMiddleware, func(c *fiber.Ctx) error {
+ return c.SendString("Successfully authenticated!")
+ })
+
+ app.Listen(":3000")
+}
+```
+
+Which results in this
+
+```bash
+# / does not need to be authenticated
+curl http://localhost:3000
+#> Welcome
+
+# /allowed needs to be authenticated too
+curl --header "Authorization: Bearer my-super-secret-key" http://localhost:3000/allowed
+#> Successfully authenticated!
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:---------------|:-----------------------------------------|:-----------------------------------------------------------------------------------------------------|:------------------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| SuccessHandler | `fiber.Handler` | SuccessHandler defines a function which is executed for a valid key. | `nil` |
+| ErrorHandler | `fiber.ErrorHandler` | ErrorHandler defines a function which is executed for an invalid key. | `401 Invalid or expired key` |
+| KeyLookup | `string` | KeyLookup is a string in the form of "`:`" that is used to extract key from the request. | "header:Authorization" |
+| AuthScheme | `string` | AuthScheme to be used in the Authorization header. | "Bearer" |
+| Validator | `func(*fiber.Ctx, string) (bool, error)` | Validator is a function to validate the key. | A function for key validation |
+| ContextKey | `interface{}` | Context key to store the bearer token from the token into context. | "token" |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ SuccessHandler: func(c *fiber.Ctx) error {
+ return c.Next()
+ },
+ ErrorHandler: func(c *fiber.Ctx, err error) error {
+ if err == ErrMissingOrMalformedAPIKey {
+ return c.Status(fiber.StatusUnauthorized).SendString(err.Error())
+ }
+ return c.Status(fiber.StatusUnauthorized).SendString("Invalid or expired API Key")
+ },
+ KeyLookup: "header:" + fiber.HeaderAuthorization,
+ AuthScheme: "Bearer",
+ ContextKey: "token",
+}
+```
diff --git a/docs/api/middleware/limiter.md b/docs/api/middleware/limiter.md
new file mode 100644
index 0000000..8a48cbd
--- /dev/null
+++ b/docs/api/middleware/limiter.md
@@ -0,0 +1,125 @@
+---
+id: limiter
+---
+
+# Limiter
+
+Limiter middleware for [Fiber](https://github.com/gofiber/fiber) that is used to limit repeat requests to public APIs and/or endpoints such as password reset. It is also useful for API clients, web crawling, or other tasks that need to be throttled.
+
+:::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.
+:::
+
+:::note
+This module does not share state with other processes/servers by default.
+:::
+
+## 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/limiter"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(limiter.New())
+
+// Or extend your config for customization
+app.Use(limiter.New(limiter.Config{
+ Next: func(c *fiber.Ctx) bool {
+ return c.IP() == "127.0.0.1"
+ },
+ Max: 20,
+ Expiration: 30 * time.Second,
+ KeyGenerator: func(c *fiber.Ctx) string {
+ return c.Get("x-forwarded-for")
+ },
+ LimitReached: func(c *fiber.Ctx) error {
+ return c.SendFile("./toofast.html")
+ },
+ Storage: myCustomStorage{},
+}))
+```
+
+## Sliding window
+
+Instead of using the standard fixed window algorithm, you can enable the [sliding window](https://en.wikipedia.org/wiki/Sliding_window_protocol) algorithm.
+
+A example of such configuration is:
+
+```go
+app.Use(limiter.New(limiter.Config{
+ Max: 20,
+ Expiration: 30 * time.Second,
+ LimiterMiddleware: limiter.SlidingWindow{},
+}))
+```
+
+This means that every window will take into account the previous window(if there was any). The given formula for the rate is:
+```
+weightOfPreviousWindpw = previous window's amount request * (whenNewWindow / Expiration)
+rate = weightOfPreviousWindpw + current window's amount request.
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:-----------------------|:--------------------------|:--------------------------------------------------------------------------------------------|:-----------------------------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| Max | `int` | Max number of recent connections during `Expiration` seconds before sending a 429 response. | 5 |
+| KeyGenerator | `func(*fiber.Ctx) string` | KeyGenerator allows you to generate custom keys, by default c.IP() is used. | A function using c.IP() as the default |
+| Expiration | `time.Duration` | Expiration is the time on how long to keep records of requests in memory. | 1 * time.Minute |
+| LimitReached | `fiber.Handler` | LimitReached is called when a request hits the limit. | A function sending 429 response |
+| SkipFailedRequests | `bool` | When set to true, requests with StatusCode >= 400 won't be counted. | false |
+| SkipSuccessfulRequests | `bool` | When set to true, requests with StatusCode < 400 won't be counted. | false |
+| Storage | `fiber.Storage` | Store is used to store the state of the middleware. | An in-memory store for this process only |
+| LimiterMiddleware | `LimiterHandler` | LimiterMiddleware is the struct that implements a limiter middleware. | A new Fixed Window Rate Limiter |
+| Duration (Deprecated) | `time.Duration` | Deprecated: Use Expiration instead | - |
+| Store (Deprecated) | `fiber.Storage` | Deprecated: Use Storage instead | - |
+| Key (Deprecated) | `func(*fiber.Ctx) string` | Deprecated: Use KeyGenerator instead | - |
+
+:::note
+A custom store can be used if it implements the `Storage` interface - more details and an example can be found in `store.go`.
+:::
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Max: 5,
+ Expiration: 1 * time.Minute,
+ KeyGenerator: func(c *fiber.Ctx) string {
+ return c.IP()
+ },
+ LimitReached: func(c *fiber.Ctx) error {
+ return c.SendStatus(fiber.StatusTooManyRequests)
+ },
+ SkipFailedRequests: false,
+ SkipSuccessfulRequests: false,
+ LimiterMiddleware: FixedWindow{},
+}
+```
+
+### Custom Storage/Database
+
+You can use any storage from our [storage](https://github.com/gofiber/storage/) package.
+
+```go
+storage := sqlite3.New() // From github.com/gofiber/storage/sqlite3
+app.Use(limiter.New(limiter.Config{
+ Storage: storage,
+}))
+```
diff --git a/docs/api/middleware/logger.md b/docs/api/middleware/logger.md
new file mode 100644
index 0000000..596ace3
--- /dev/null
+++ b/docs/api/middleware/logger.md
@@ -0,0 +1,168 @@
+---
+id: logger
+---
+
+# Logger
+
+Logger middleware for [Fiber](https://github.com/gofiber/fiber) that logs HTTP request/response details.
+
+## 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/logger"
+)
+```
+
+:::tip
+The order of registration plays a role. Only all routes that are registered after this one will be logged.
+The middleware should therefore be one of the first to be registered.
+:::
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(logger.New())
+
+// Or extend your config for customization
+// Logging remote IP and Port
+app.Use(logger.New(logger.Config{
+ Format: "[${ip}]:${port} ${status} - ${method} ${path}\n",
+}))
+
+// Logging Request ID
+app.Use(requestid.New())
+app.Use(logger.New(logger.Config{
+ // For more options, see the Config section
+ Format: "${pid} ${locals:requestid} ${status} - ${method} ${path}\n",
+}))
+
+// Changing TimeZone & TimeFormat
+app.Use(logger.New(logger.Config{
+ Format: "${pid} ${status} - ${method} ${path}\n",
+ TimeFormat: "02-Jan-2006",
+ TimeZone: "America/New_York",
+}))
+
+// Custom File Writer
+file, err := os.OpenFile("./123.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
+if err != nil {
+ log.Fatalf("error opening file: %v", err)
+}
+defer file.Close()
+app.Use(logger.New(logger.Config{
+ Output: file,
+}))
+
+// Add Custom Tags
+app.Use(logger.New(logger.Config{
+ CustomTags: map[string]logger.LogFunc{
+ "custom_tag": func(output logger.Buffer, c *fiber.Ctx, data *logger.Data, extraParam string) (int, error) {
+ return output.WriteString("it is a custom tag")
+ },
+ },
+}))
+
+// Callback after log is written
+app.Use(logger.New(logger.Config{
+ TimeFormat: time.RFC3339Nano,
+ TimeZone: "Asia/Shanghai",
+ Done: func(c *fiber.Ctx, logString []byte) {
+ if c.Response().StatusCode() != fiber.StatusOK {
+ reporter.SendToSlack(logString)
+ }
+ },
+}))
+
+// Disable colors when outputting to default format
+app.Use(logger.New(logger.Config{
+ DisableColors: true,
+}))
+```
+
+## Config
+
+### Config
+
+| Property | Type | Description | Default |
+|:-----------------|:---------------------------|:---------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| Done | `func(*fiber.Ctx, []byte)` | Done is a function that is called after the log string for a request is written to Output, and pass the log string as parameter. | `nil` |
+| CustomTags | `map[string]LogFunc` | tagFunctions defines the custom tag action. | `map[string]LogFunc` |
+| Format | `string` | Format defines the logging tags. | `${time} \| ${status} \| ${latency} \| ${ip} \| ${method} \| ${path} \| ${error}\n` || TimeFormat | `string` | TimeFormat defines the time format for log timestamps. | `15:04:05` |
+| TimeZone | `string` | TimeZone can be specified, such as "UTC" and "America/New_York" and "Asia/Chongqing", etc | `"Local"` |
+| TimeInterval | `time.Duration` | TimeInterval is the delay before the timestamp is updated. | `500 * time.Millisecond` |
+| Output | `io.Writer` | Output is a writer where logs are written. | `os.Stdout` |
+| DisableColors | `bool` | DisableColors defines if the logs output should be colorized. | `false` |
+| enableColors | `bool` | Internal field for enabling colors in the log output. (This is not a user-configurable field) | - |
+| enableLatency | `bool` | Internal field for enabling latency measurement in logs. (This is not a user-configurable field) | - |
+| timeZoneLocation | `*time.Location` | Internal field for the time zone location. (This is not a user-configurable field) | - |
+
+## Default Config
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ Done: nil,
+ Format: "${time} | ${status} | ${latency} | ${ip} | ${method} | ${path} | ${error}\n",
+ TimeFormat: "15:04:05",
+ TimeZone: "Local",
+ TimeInterval: 500 * time.Millisecond,
+ Output: os.Stdout,
+ DisableColors: false,
+}
+```
+
+## Constants
+```go
+// Logger variables
+const (
+ TagPid = "pid"
+ TagTime = "time"
+ TagReferer = "referer"
+ TagProtocol = "protocol"
+ TagPort = "port"
+ TagIP = "ip"
+ TagIPs = "ips"
+ TagHost = "host"
+ TagMethod = "method"
+ TagPath = "path"
+ TagURL = "url"
+ TagUA = "ua"
+ TagLatency = "latency"
+ TagStatus = "status" // response status
+ TagResBody = "resBody" // response body
+ TagReqHeaders = "reqHeaders"
+ TagQueryStringParams = "queryParams" // request query parameters
+ TagBody = "body" // request body
+ TagBytesSent = "bytesSent"
+ TagBytesReceived = "bytesReceived"
+ TagRoute = "route"
+ TagError = "error"
+ // DEPRECATED: Use TagReqHeader instead
+ TagHeader = "header:" // request header
+ TagReqHeader = "reqHeader:" // request header
+ TagRespHeader = "respHeader:" // response header
+ TagQuery = "query:" // request query
+ TagForm = "form:" // request form
+ TagCookie = "cookie:" // request cookie
+ TagLocals = "locals:"
+ // colors
+ TagBlack = "black"
+ TagRed = "red"
+ TagGreen = "green"
+ TagYellow = "yellow"
+ TagBlue = "blue"
+ TagMagenta = "magenta"
+ TagCyan = "cyan"
+ TagWhite = "white"
+ TagReset = "reset"
+)
+```
diff --git a/docs/api/middleware/monitor.md b/docs/api/middleware/monitor.md
new file mode 100644
index 0000000..cbac367
--- /dev/null
+++ b/docs/api/middleware/monitor.md
@@ -0,0 +1,81 @@
+---
+id: monitor
+---
+
+# Monitor
+
+Monitor middleware for [Fiber](https://github.com/gofiber/fiber) that reports server metrics, inspired by [express-status-monitor](https://github.com/RafalWilinski/express-status-monitor)
+
+:::caution
+
+Monitor is still in beta, API might change in the future!
+
+:::
+
+
+
+### Signatures
+```go
+func New() 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/monitor"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+```go
+// Initialize default config (Assign the middleware to /metrics)
+app.Get("/metrics", monitor.New())
+
+// Or extend your config for customization
+// Assign the middleware to /metrics
+// and change the Title to `MyService Metrics Page`
+app.Get("/metrics", monitor.New(monitor.Config{Title: "MyService Metrics Page"}))
+```
+You can also access the API endpoint with
+`curl -X GET -H "Accept: application/json" http://localhost:3000/metrics` which returns:
+```json
+{"pid":{ "cpu":0.4568381746582226, "ram":20516864, "conns":3 },
+ "os": { "cpu":8.759124087593099, "ram":3997155328, "conns":44,
+ "total_ram":8245489664, "load_avg":0.51 }}
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:-----------|:------------------------|:--------------------------------------------------------------------|:----------------------------------------------------------------------------|
+| Title | `string` | Metrics page title | "Fiber Monitor" |
+| Refresh | `time.Duration` | Refresh period | 3 seconds |
+| APIOnly | `bool` | Whether the service should expose only the monitoring API | false |
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| CustomHead | `string` | Custom HTML Code to Head Section(Before End) | empty |
+| FontURL | `string` | FontURL for specify font resource path or URL | "https://fonts.googleapis.com/css2?family=Roboto:wght@400;900&display=swap" |
+| ChartJsURL | `string` | ChartJsURL for specify ChartJS library path or URL | "https://cdn.jsdelivr.net/npm/chart.js@2.9/dist/Chart.bundle.min.js" |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Title: defaultTitle,
+ Refresh: defaultRefresh,
+ FontURL: defaultFontURL,
+ ChartJsURL: defaultChartJSURL,
+ CustomHead: defaultCustomHead,
+ APIOnly: false,
+ Next: nil,
+ index: newIndex(viewBag{
+ defaultTitle,
+ defaultRefresh,
+ defaultFontURL,
+ defaultChartJSURL,
+ defaultCustomHead,
+ }),
+}
+```
diff --git a/docs/api/middleware/pprof.md b/docs/api/middleware/pprof.md
new file mode 100644
index 0000000..c4808f2
--- /dev/null
+++ b/docs/api/middleware/pprof.md
@@ -0,0 +1,53 @@
+---
+id: pprof
+---
+
+# Pprof
+
+Pprof middleware for [Fiber](https://github.com/gofiber/fiber) that serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool. The package is typically only imported for the side effect of registering its HTTP handlers. The handled paths all begin with /debug/pprof/.
+
+## Signatures
+
+```go
+func New() 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/pprof"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(pprof.New())
+
+// Or extend your config for customization
+
+// For example, in systems where you have multiple ingress endpoints, it is common to add a URL prefix, like so:
+app.Use(pprof.New(pprof.Config{Prefix: "/endpoint-prefix"}))
+
+// This prefix will be added to the default path of "/debug/pprof/", for a resulting URL of: "/endpoint-prefix/debug/pprof/".
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:---------|:------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------|:--------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| Prefix | `string` | Prefix defines a URL prefix added before "/debug/pprof". Note that it should start with (but not end with) a slash. Example: "/federated-fiber" | "" |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+}
+```
diff --git a/docs/api/middleware/proxy.md b/docs/api/middleware/proxy.md
new file mode 100644
index 0000000..e36654f
--- /dev/null
+++ b/docs/api/middleware/proxy.md
@@ -0,0 +1,165 @@
+---
+id: proxy
+---
+
+# Proxy
+
+Proxy middleware for [Fiber](https://github.com/gofiber/fiber) that allows you to proxy requests to multiple servers.
+
+## Signatures
+
+```go
+// Balancer create a load balancer among multiple upstrem servers.
+func Balancer(config Config) fiber.Handler
+// Forward performs the given http request and fills the given http response.
+func Forward(addr string, clients ...*fasthttp.Client) fiber.Handler
+// Do performs the given http request and fills the given http response.
+func Do(c *fiber.Ctx, addr string, clients ...*fasthttp.Client) error
+// DoRedirects performs the given http request and fills the given http response while following up to maxRedirectsCount redirects.
+func DoRedirects(c *fiber.Ctx, addr string, maxRedirectsCount int, clients ...*fasthttp.Client) error
+// DoDeadline performs the given request and waits for response until the given deadline.
+func DoDeadline(c *fiber.Ctx, addr string, deadline time.Time, clients ...*fasthttp.Client) error
+// DoTimeout performs the given request and waits for response during the given timeout duration.
+func DoTimeout(c *fiber.Ctx, addr string, timeout time.Duration, clients ...*fasthttp.Client) error
+// DomainForward the given http request based on the given domain and fills the given http response
+func DomainForward(hostname string, addr string, clients ...*fasthttp.Client) fiber.Handler
+// BalancerForward performs the given http request based round robin balancer and fills the given http response
+func BalancerForward(servers []string, clients ...*fasthttp.Client) 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/proxy"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// if target https site uses a self-signed certificate, you should
+// call WithTlsConfig before Do and Forward
+proxy.WithTlsConfig(&tls.Config{
+ InsecureSkipVerify: true,
+})
+// if you need to use global self-custom client, you should use proxy.WithClient.
+proxy.WithClient(&fasthttp.Client{
+ NoDefaultUserAgentHeader: true,
+ DisablePathNormalizing: true,
+})
+
+// Forward to url
+app.Get("/gif", proxy.Forward("https://i.imgur.com/IWaBepg.gif"))
+
+// If you want to forward with a specific domain. You have to use proxy.DomainForward.
+app.Get("/payments", proxy.DomainForward("docs.gofiber.io", "http://localhost:8000"))
+
+// Forward to url with local custom client
+app.Get("/gif", proxy.Forward("https://i.imgur.com/IWaBepg.gif", &fasthttp.Client{
+ NoDefaultUserAgentHeader: true,
+ DisablePathNormalizing: true,
+}))
+
+// Make request within handler
+app.Get("/:id", func(c *fiber.Ctx) error {
+ url := "https://i.imgur.com/"+c.Params("id")+".gif"
+ if err := proxy.Do(c, url); err != nil {
+ return err
+ }
+ // Remove Server header from response
+ c.Response().Header.Del(fiber.HeaderServer)
+ return nil
+})
+
+// Make proxy requests while following redirects
+app.Get("/proxy", func(c *fiber.Ctx) error {
+ if err := proxy.DoRedirects(c, "http://google.com", 3); err != nil {
+ return err
+ }
+ // Remove Server header from response
+ c.Response().Header.Del(fiber.HeaderServer)
+ return nil
+})
+
+// Make proxy requests and wait up to 5 seconds before timing out
+app.Get("/proxy", func(c *fiber.Ctx) error {
+ if err := proxy.DoTimeout(c, "http://localhost:3000", time.Second * 5); err != nil {
+ return err
+ }
+ // Remove Server header from response
+ c.Response().Header.Del(fiber.HeaderServer)
+ return nil
+})
+
+// Make proxy requests, timeout a minute from now
+app.Get("/proxy", func(c *fiber.Ctx) error {
+ if err := proxy.DoDeadline(c, "http://localhost", time.Now().Add(time.Minute)); err != nil {
+ return err
+ }
+ // Remove Server header from response
+ c.Response().Header.Del(fiber.HeaderServer)
+ return nil
+})
+
+// Minimal round robin balancer
+app.Use(proxy.Balancer(proxy.Config{
+ Servers: []string{
+ "http://localhost:3001",
+ "http://localhost:3002",
+ "http://localhost:3003",
+ },
+}))
+
+// Or extend your balancer for customization
+app.Use(proxy.Balancer(proxy.Config{
+ Servers: []string{
+ "http://localhost:3001",
+ "http://localhost:3002",
+ "http://localhost:3003",
+ },
+ ModifyRequest: func(c *fiber.Ctx) error {
+ c.Request().Header.Add("X-Real-IP", c.IP())
+ return nil
+ },
+ ModifyResponse: func(c *fiber.Ctx) error {
+ c.Response().Header.Del(fiber.HeaderServer)
+ return nil
+ },
+}))
+
+// Or this way if the balancer is using https and the destination server is only using http.
+app.Use(proxy.BalancerForward([]string{
+ "http://localhost:3001",
+ "http://localhost:3002",
+ "http://localhost:3003",
+}))
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:----------------|:-----------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| Servers | `[]string` | Servers defines a list of `://` HTTP servers, which are used in a round-robin manner. i.e.: "https://foobar.com, http://www.foobar.com" | (Required) |
+| ModifyRequest | `fiber.Handler` | ModifyRequest allows you to alter the request. | `nil` |
+| ModifyResponse | `fiber.Handler` | ModifyResponse allows you to alter the response. | `nil` |
+| Timeout | `time.Duration` | Timeout is the request timeout used when calling the proxy client. | 1 second |
+| 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). | (Not specified) |
+| WriteBufferSize | `int` | Per-connection buffer size for responses' writing. | (Not specified) |
+| TlsConfig | `*tls.Config` (or `*fasthttp.TLSConfig` in v3) | TLS config for the HTTP client. | `nil` |
+| Client | `*fasthttp.LBClient` | Client is a custom client when client config is complex. | `nil` |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ ModifyRequest: nil,
+ ModifyResponse: nil,
+ Timeout: fasthttp.DefaultLBClientTimeout,
+}
+```
diff --git a/docs/api/middleware/recover.md b/docs/api/middleware/recover.md
new file mode 100644
index 0000000..81f67fd
--- /dev/null
+++ b/docs/api/middleware/recover.md
@@ -0,0 +1,54 @@
+---
+id: recover
+---
+
+# Recover
+
+Recover middleware for [Fiber](https://github.com/gofiber/fiber) that recovers from panics anywhere in the stack chain and handles the control to the centralized [ErrorHandler](https://docs.gofiber.io/guide/error-handling).
+
+## 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/recover"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(recover.New())
+
+// This panic will be caught by the middleware
+app.Get("/", func(c *fiber.Ctx) error {
+ panic("I'm an error")
+})
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:------------------|:--------------------------------|:--------------------------------------------------------------------|:-------------------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| EnableStackTrace | `bool` | EnableStackTrace enables handling stack trace. | `false` |
+| StackTraceHandler | `func(*fiber.Ctx, interface{})` | StackTraceHandler defines a function to handle stack trace. | defaultStackTraceHandler |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ EnableStackTrace: false,
+ StackTraceHandler: defaultStackTraceHandler,
+}
+```
diff --git a/docs/api/middleware/redirect.md b/docs/api/middleware/redirect.md
new file mode 100644
index 0000000..762aa0b
--- /dev/null
+++ b/docs/api/middleware/redirect.md
@@ -0,0 +1,68 @@
+---
+id: redirect
+---
+
+# Redirect
+
+Redirection middleware for Fiber.
+
+## Signatures
+
+```go
+func New(config ...Config) fiber.Handler
+```
+
+## Examples
+
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/redirect"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Use(redirect.New(redirect.Config{
+ Rules: map[string]string{
+ "/old": "/new",
+ "/old/*": "/new/$1",
+ },
+ StatusCode: 301,
+ }))
+
+ app.Get("/new", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World!")
+ })
+ app.Get("/new/*", func(c *fiber.Ctx) error {
+ return c.SendString("Wildcard: " + c.Params("*"))
+ })
+
+ app.Listen(":3000")
+}
+```
+
+**Test:**
+
+```curl
+curl http://localhost:3000/old
+curl http://localhost:3000/old/hello
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:-----------|:------------------------|:---------------------------------------------------------------------------------------------------------------------------|:-----------------------|
+| Next | `func(*fiber.Ctx) bool` | Filter defines a function to skip middleware. | `nil` |
+| Rules | `map[string]string` | Rules defines the URL path rewrite rules. The values captured in asterisk can be retrieved by index e.g. $1, $2 and so on. | Required |
+| StatusCode | `int` | The status code when redirecting. This is ignored if Redirect is disabled. | 302 Temporary Redirect |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ StatusCode: fiber.StatusFound,
+}
+```
diff --git a/docs/api/middleware/requestid.md b/docs/api/middleware/requestid.md
new file mode 100644
index 0000000..c8ca8d5
--- /dev/null
+++ b/docs/api/middleware/requestid.md
@@ -0,0 +1,62 @@
+---
+id: requestid
+---
+
+# RequestID
+
+RequestID middleware for [Fiber](https://github.com/gofiber/fiber) that adds an identifier to the 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/requestid"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+app.Use(requestid.New())
+
+// Or extend your config for customization
+app.Use(requestid.New(requestid.Config{
+ Header: "X-Custom-Header",
+ Generator: func() string {
+ return "static-id"
+ },
+}))
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:-----------|:------------------------|:--------------------------------------------------------------------------------------------------|:---------------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
+| Header | `string` | Header is the header key where to get/set the unique request ID. | "X-Request-ID" |
+| Generator | `func() string` | Generator defines a function to generate the unique identifier. | utils.UUID |
+| ContextKey | `interface{}` | ContextKey defines the key used when storing the request ID in the locals for a specific request. | "requestid" |
+
+## Default Config
+The default config uses a fast UUID generator which will expose the number of
+requests made to the server. To conceal this value for better privacy, use the
+`utils.UUIDv4` generator.
+
+```go
+var ConfigDefault = Config{
+ Next: nil,
+ Header: fiber.HeaderXRequestID,
+ Generator: utils.UUID,
+ ContextKey: "requestid",
+}
+```
diff --git a/docs/api/middleware/rewrite.md b/docs/api/middleware/rewrite.md
new file mode 100644
index 0000000..fd59595
--- /dev/null
+++ b/docs/api/middleware/rewrite.md
@@ -0,0 +1,58 @@
+---
+id: rewrite
+---
+
+# 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.
+
+## Signatures
+
+```go
+func New(config ...Config) fiber.Handler
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:---------|:------------------------|:-----------------------------------------------------------------------------------------------------|:-----------|
+| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip middleware. | `nil` |
+| Rules | `map[string]string` | Rules defines the URL path rewrite rules. The values captured in asterisk can be retrieved by index. | (Required) |
+
+### Examples
+```go
+package main
+
+import (
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/rewrite"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Use(rewrite.New(rewrite.Config{
+ Rules: map[string]string{
+ "/old": "/new",
+ "/old/*": "/new/$1",
+ },
+ }))
+
+ app.Get("/new", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World!")
+ })
+ app.Get("/new/*", func(c *fiber.Ctx) error {
+ return c.SendString("Wildcard: " + c.Params("*"))
+ })
+
+ app.Listen(":3000")
+}
+
+```
+
+**Test:**
+
+```curl
+curl http://localhost:3000/old
+curl http://localhost:3000/old/hello
+```
diff --git a/docs/api/middleware/session.md b/docs/api/middleware/session.md
new file mode 100644
index 0000000..6315995
--- /dev/null
+++ b/docs/api/middleware/session.md
@@ -0,0 +1,139 @@
+---
+id: session
+---
+
+# Session
+
+Session middleware for [Fiber](https://github.com/gofiber/fiber).
+
+:::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) *Store
+func (s *Store) RegisterType(i interface{})
+func (s *Store) Get(c *fiber.Ctx) (*Session, error)
+func (s *Store) Delete(id string) error
+func (s *Store) Reset() error
+
+func (s *Session) Get(key string) interface{}
+func (s *Session) Set(key string, val interface{})
+func (s *Session) Delete(key string)
+func (s *Session) Destroy() error
+func (s *Session) Reset() error
+func (s *Session) Regenerate() error
+func (s *Session) Save() error
+func (s *Session) Fresh() bool
+func (s *Session) ID() string
+func (s *Session) Keys() []string
+```
+
+:::caution
+Storing `interface{}` values are limited to built-ins Go types.
+:::
+
+## 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/session"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+// Initialize default config
+// This stores all of your app's sessions
+store := session.New()
+
+app.Get("/", func(c *fiber.Ctx) error {
+ // Get session from storage
+ sess, err := store.Get(c)
+ if err != nil {
+ panic(err)
+ }
+
+ // Get value
+ name := sess.Get("name")
+
+ // Set key/value
+ sess.Set("name", "john")
+
+ // Get all Keys
+ keys := sess.Keys()
+
+ // Delete key
+ sess.Delete("name")
+
+ // Destroy session
+ if err := sess.Destroy(); err != nil {
+ panic(err)
+ }
+
+ // Sets a specific expiration for this session
+ sess.SetExpiry(time.Second * 2)
+
+ // Save session
+ if err := sess.Save(); err != nil {
+ panic(err)
+ }
+
+ return c.SendString(fmt.Sprintf("Welcome %v", name))
+})
+```
+
+## Config
+
+| Property | Type | Description | Default |
+|:------------------------|:----------------|:------------------------------------------------------------------------------------------------------------|:----------------------|
+| Expiration | `time.Duration` | Allowed session duration. | `24 * time.Hour` |
+| Storage | `fiber.Storage` | Storage interface to store the session data. | `memory.New()` |
+| KeyLookup | `string` | KeyLookup is a string in the form of "`:`" that is used to extract session id from the request. | `"cookie:session_id"` |
+| CookieDomain | `string` | Domain of the cookie. | `""` |
+| CookiePath | `string` | Path of the cookie. | `""` |
+| CookieSecure | `bool` | Indicates if cookie is secure. | `false` |
+| CookieHTTPOnly | `bool` | Indicates if cookie is HTTP only. | `false` |
+| CookieSameSite | `string` | Value of SameSite cookie. | `"Lax"` |
+| CookieSessionOnly | `bool` | Decides whether cookie should last for only the browser session. Ignores Expiration if set to true. | `false` |
+| KeyGenerator | `func() string` | KeyGenerator generates the session key. | `utils.UUIDv4` |
+| CookieName (Deprecated) | `string` | Deprecated: Please use KeyLookup. The session name. | `""` |
+
+## Default Config
+
+```go
+var ConfigDefault = Config{
+ Expiration: 24 * time.Hour,
+ KeyLookup: "cookie:session_id",
+ KeyGenerator: utils.UUIDv4,
+ source: "cookie",
+ sessionName: "session_id",
+}
+```
+
+## Constants
+
+```go
+const (
+ SourceCookie Source = "cookie"
+ SourceHeader Source = "header"
+ SourceURLQuery Source = "query"
+)
+```
+
+### Custom Storage/Database
+
+You can use any storage from our [storage](https://github.com/gofiber/storage/) package.
+
+```go
+storage := sqlite3.New() // From github.com/gofiber/storage/sqlite3
+store := session.New(session.Config{
+ Storage: storage,
+})
+```
+
+To use the store, see the [Examples](#examples).
diff --git a/docs/api/middleware/skip.md b/docs/api/middleware/skip.md
new file mode 100644
index 0000000..0923bd0
--- /dev/null
+++ b/docs/api/middleware/skip.md
@@ -0,0 +1,47 @@
+---
+id: skip
+---
+
+# Skip
+
+Skip middleware for [Fiber](https://github.com/gofiber/fiber) that skips a wrapped handler if a predicate is true.
+
+## Signatures
+```go
+func New(handler fiber.Handler, exclude func(c *fiber.Ctx) bool) 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/skip"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+func main() {
+ app := fiber.New()
+
+ app.Use(skip.New(BasicHandler, func(ctx *fiber.Ctx) bool {
+ return ctx.Method() == fiber.MethodGet
+ }))
+
+ app.Get("/", func(ctx *fiber.Ctx) error {
+ return ctx.SendString("It was a GET request!")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+
+func BasicHandler(ctx *fiber.Ctx) error {
+ return ctx.SendString("It was not a GET request!")
+}
+```
+
+:::tip
+app.Use will handle requests from any route, and any method. In the example above, it will only skip if the method is GET.
+:::
diff --git a/docs/api/middleware/timeout.md b/docs/api/middleware/timeout.md
new file mode 100644
index 0000000..5fdf18d
--- /dev/null
+++ b/docs/api/middleware/timeout.md
@@ -0,0 +1,146 @@
+---
+id: timeout
+---
+
+# Timeout
+
+There exist two distinct implementations of timeout middleware [Fiber](https://github.com/gofiber/fiber).
+
+**New**
+
+Wraps a `fiber.Handler` with a timeout. If the handler takes longer than the given duration to return, the timeout error is set and forwarded to the centralized [ErrorHandler](https://docs.gofiber.io/error-handling).
+
+:::caution
+This has been deprecated since it raises race conditions.
+:::
+
+**NewWithContext**
+
+As a `fiber.Handler` wrapper, it creates a context with `context.WithTimeout` and pass it in `UserContext`.
+
+If the context passed executions (eg. DB ops, Http calls) takes longer than the given duration to return, the timeout error is set and forwarded to the centralized `ErrorHandler`.
+
+
+It does not cancel long running executions. Underlying executions must handle timeout by using `context.Context` parameter.
+
+## Signatures
+
+```go
+func New(handler fiber.Handler, timeout time.Duration, timeoutErrors ...error) fiber.Handler
+func NewWithContext(handler fiber.Handler, timeout time.Duration, timeoutErrors ...error) 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/timeout"
+)
+```
+
+After you initiate your Fiber app, you can use the following possibilities:
+
+```go
+func main() {
+ app := fiber.New()
+
+ h := func(c *fiber.Ctx) error {
+ sleepTime, _ := time.ParseDuration(c.Params("sleepTime") + "ms")
+ if err := sleepWithContext(c.UserContext(), sleepTime); err != nil {
+ return fmt.Errorf("%w: execution error", err)
+ }
+ return nil
+ }
+
+ app.Get("/foo/:sleepTime", timeout.New(h, 2*time.Second))
+ log.Fatal(app.Listen(":3000"))
+}
+
+func sleepWithContext(ctx context.Context, d time.Duration) error {
+ timer := time.NewTimer(d)
+
+ select {
+ case <-ctx.Done():
+ if !timer.Stop() {
+ <-timer.C
+ }
+ return context.DeadlineExceeded
+ case <-timer.C:
+ }
+ return nil
+}
+```
+
+Test http 200 with curl:
+
+```bash
+curl --location -I --request GET 'http://localhost:3000/foo/1000'
+```
+
+Test http 408 with curl:
+
+```bash
+curl --location -I --request GET 'http://localhost:3000/foo/3000'
+```
+
+Use with custom error:
+
+```go
+var ErrFooTimeOut = errors.New("foo context canceled")
+
+func main() {
+ app := fiber.New()
+ h := func(c *fiber.Ctx) error {
+ sleepTime, _ := time.ParseDuration(c.Params("sleepTime") + "ms")
+ if err := sleepWithContextWithCustomError(c.UserContext(), sleepTime); err != nil {
+ return fmt.Errorf("%w: execution error", err)
+ }
+ return nil
+ }
+
+ app.Get("/foo/:sleepTime", timeout.NewWithContext(h, 2*time.Second, ErrFooTimeOut))
+ log.Fatal(app.Listen(":3000"))
+}
+
+func sleepWithContextWithCustomError(ctx context.Context, d time.Duration) error {
+ timer := time.NewTimer(d)
+ select {
+ case <-ctx.Done():
+ if !timer.Stop() {
+ <-timer.C
+ }
+ return ErrFooTimeOut
+ case <-timer.C:
+ }
+ return nil
+}
+```
+
+Sample usage with a DB call:
+
+```go
+func main() {
+ app := fiber.New()
+ db, _ := gorm.Open(postgres.Open("postgres://localhost/foodb"), &gorm.Config{})
+
+ handler := func(ctx *fiber.Ctx) error {
+ tran := db.WithContext(ctx.UserContext()).Begin()
+
+ if tran = tran.Exec("SELECT pg_sleep(50)"); tran.Error != nil {
+ return tran.Error
+ }
+
+ if tran = tran.Commit(); tran.Error != nil {
+ return tran.Error
+ }
+
+ return nil
+ }
+
+ app.Get("/foo", timeout.NewWithContext(handler, 10*time.Second))
+ log.Fatal(app.Listen(":3000"))
+}
+```
diff --git a/docs/extra/_category_.json b/docs/extra/_category_.json
new file mode 100644
index 0000000..f17f137
--- /dev/null
+++ b/docs/extra/_category_.json
@@ -0,0 +1,8 @@
+{
+ "label": "Extra",
+ "position": 4,
+ "link": {
+ "type": "generated-index",
+ "description": "Extra contents for Fiber."
+ }
+}
\ No newline at end of file
diff --git a/docs/extra/benchmarks.md b/docs/extra/benchmarks.md
new file mode 100644
index 0000000..3c2a820
--- /dev/null
+++ b/docs/extra/benchmarks.md
@@ -0,0 +1,112 @@
+---
+id: benchmarks
+title: 📊 Benchmarks
+description: >-
+ These benchmarks aim to compare the performance of Fiber and other web
+ frameworks.
+sidebar_position: 2
+---
+
+## TechEmpower
+
+[TechEmpower](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=composite) provides a performance comparison of many web application frameworks executing fundamental tasks such as JSON serialization, database access, and server-side template composition.
+
+Each framework is operating in a realistic production configuration. Results are captured on cloud instances and on physical hardware. The test implementations are largely community-contributed and all source is available at the [GitHub repository](https://github.com/TechEmpower/FrameworkBenchmarks).
+
+* Fiber `v1.10.0`
+* 28 HT Cores Intel\(R\) Xeon\(R\) Gold 5120 CPU @ 2.20GHz
+* 32GB RAM
+* Ubuntu 18.04.3 4.15.0-88-generic
+* Dedicated Cisco 10-Gbit Ethernet switch.
+
+### Plaintext
+
+The Plaintext test is an exercise of the request-routing fundamentals only, designed to demonstrate the capacity of high-performance platforms in particular. Requests will be sent using HTTP pipelining. The response payload is still small, meaning good performance is still necessary in order to saturate the gigabit Ethernet of the test environment.
+
+See [Plaintext requirements](https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Project-Information-Framework-Tests-Overview#single-database-query)
+
+**Fiber** - **6,162,556** responses per second with an average latency of **2.0** ms.
+**Express** - **367,069** responses per second with an average latency of **354.1** ms.
+
+
+
+
+
+### Data Updates
+
+**Fiber** handled **11,846** responses per second with an average latency of **42.8** ms.
+**Express** handled **2,066** responses per second with an average latency of **390.44** ms.
+
+
+
+
+
+### Multiple Queries
+
+**Fiber** handled **19,664** responses per second with an average latency of **25.7** ms.
+**Express** handled **4,302** responses per second with an average latency of **117.2** ms.
+
+
+
+
+
+### Single Query
+
+**Fiber** handled **368,647** responses per second with an average latency of **0.7** ms.
+**Express** handled **57,880** responses per second with an average latency of **4.4** ms.
+
+
+
+
+
+### JSON Serialization
+
+**Fiber** handled **1,146,667** responses per second with an average latency of **0.4** ms.
+**Express** handled **244,847** responses per second with an average latency of **1.1** ms.
+
+
+
+
+
+## Go web framework benchmark
+
+🔗 [https://github.com/smallnest/go-web-framework-benchmark](https://github.com/smallnest/go-web-framework-benchmark)
+
+* **CPU** Intel\(R\) Xeon\(R\) Gold 6140 CPU @ 2.30GHz
+* **MEM** 4GB
+* **GO** go1.13.6 linux/amd64
+* **OS** Linux
+
+The first test case is to mock **0 ms**, **10 ms**, **100 ms**, **500 ms** processing time in handlers.
+
+
+
+The concurrency clients are **5000**.
+
+
+
+Latency is the time of real processing time by web servers. _The smaller is the better._
+
+
+
+Allocs is the heap allocations by web servers when test is running. The unit is MB. _The smaller is the better._
+
+If we enable **http pipelining**, test result as below:
+
+
+
+Concurrency test in **30 ms** processing time, the test result for **100**, **1000**, **5000** clients is:
+
+
+
+
+
+
+
+If we enable **http pipelining**, test result as below:
+
+
+
+Dependency graph for `v1.9.0`
+
+
diff --git a/docs/extra/faq.md b/docs/extra/faq.md
new file mode 100644
index 0000000..54dbca5
--- /dev/null
+++ b/docs/extra/faq.md
@@ -0,0 +1,169 @@
+---
+id: faq
+title: 🤔 FAQ
+description: >-
+ List of frequently asked questions. Feel free to open an issue to add your
+ question to this page.
+sidebar_position: 1
+---
+
+## How should I structure my application?
+
+There is no definitive answer to this question. The answer depends on the scale of your application and the team that is involved. To be as flexible as possible, Fiber makes no assumptions in terms of structure.
+
+Routes and other application-specific logic can live in as many files as you wish, in any directory structure you prefer. View the following examples for inspiration:
+
+* [gofiber/boilerplate](https://github.com/gofiber/boilerplate)
+* [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
+* [Youtube - Building a REST API using Gorm and Fiber](https://www.youtube.com/watch?v=Iq2qT0fRhAA)
+* [embedmode/fiberseed](https://github.com/embedmode/fiberseed)
+
+## How do I handle custom 404 responses?
+
+If you're using v2.32.0 or later, all you need to do is to implement a custom error handler. See below, or see a more detailed explanation at [Error Handling](../guide/error-handling.md#custom-error-handler).
+
+If you're using v2.31.0 or earlier, the error handler will not capture 404 errors. Instead, you need to add a middleware function at the very bottom of the stack \(below all other functions\) to handle a 404 response:
+
+```go title="Example"
+app.Use(func(c *fiber.Ctx) error {
+ return c.Status(fiber.StatusNotFound).SendString("Sorry can't find that!")
+})
+```
+
+## How can i use live reload ?
+
+[Air](https://github.com/cosmtrek/air) is a handy tool that automatically restarts your Go applications whenever the source code changes, making your development process faster and more efficient.
+
+To use Air in a Fiber project, follow these steps:
+
+1. Install Air by downloading the appropriate binary for your operating system from the GitHub release page or by building the tool directly from source.
+2. Create a configuration file for Air in your project directory. This file can be named, for example, .air.toml or air.conf. Here's a sample configuration file that works with Fiber:
+```toml
+# .air.toml
+root = "."
+tmp_dir = "tmp"
+[build]
+ cmd = "go build -o ./tmp/main ."
+ bin = "./tmp/main"
+ delay = 1000 # ms
+ exclude_dir = ["assets", "tmp", "vendor"]
+ include_ext = ["go", "tpl", "tmpl", "html"]
+ exclude_regex = ["_test\\.go"]
+```
+3. Start your Fiber application using Air by running the following command in the terminal:
+```sh
+air
+```
+
+As you make changes to your source code, Air will detect them and automatically restart the application.
+
+A complete example demonstrating the use of Air with Fiber can be found in the [Fiber Recipes repository](https://github.com/gofiber/recipes/tree/master/air). This example shows how to configure and use Air in a Fiber project to create an efficient development environment.
+
+
+## How do I set up an error handler?
+
+To override the default error handler, you can override the default when providing a [Config](../api/fiber.md#config) when initiating a new [Fiber instance](../api/fiber.md#new).
+
+```go title="Example"
+app := fiber.New(fiber.Config{
+ ErrorHandler: func(c *fiber.Ctx, err error) error {
+ return c.Status(fiber.StatusInternalServerError).SendString(err.Error())
+ },
+})
+```
+
+We have a dedicated page explaining how error handling works in Fiber, see [Error Handling](../guide/error-handling.md).
+
+## Which template engines does Fiber support?
+
+Fiber currently supports 9 template engines in our [gofiber/template](https://docs.gofiber.io/template/) middleware:
+
+* [ace](https://docs.gofiber.io/template/ace/)
+* [amber](https://docs.gofiber.io/template/amber/)
+* [django](https://docs.gofiber.io/template/django/)
+* [handlebars](https://docs.gofiber.io/template/handlebars)
+* [html](https://docs.gofiber.io/template/html)
+* [jet](https://docs.gofiber.io/template/jet)
+* [mustache](https://docs.gofiber.io/template/mustache)
+* [pug](https://docs.gofiber.io/template/pug)
+* [slim](https://docs.gofiber.io/template/pug)
+
+To learn more about using Templates in Fiber, see [Templates](../guide/templates.md).
+
+## Does Fiber have a community chat?
+
+Yes, we have our own [Discord ](https://gofiber.io/discord)server, where we hang out. We have different rooms for every subject.
+If you have questions or just want to have a chat, feel free to join us via this **>** [**invite link**](https://gofiber.io/discord) **<**.
+
+
+
+## Does fiber support sub domain routing ?
+
+Yes we do, here are some examples:
+This example works v2
+```go
+package main
+
+import (
+ "log"
+
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/logger"
+)
+
+type Host struct {
+ Fiber *fiber.App
+}
+
+func main() {
+ // Hosts
+ hosts := map[string]*Host{}
+ //-----
+ // API
+ //-----
+ api := fiber.New()
+ api.Use(logger.New(logger.Config{
+ Format: "[${ip}]:${port} ${status} - ${method} ${path}\n",
+ }))
+ hosts["api.localhost:3000"] = &Host{api}
+ api.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("API")
+ })
+ //------
+ // Blog
+ //------
+ blog := fiber.New()
+ blog.Use(logger.New(logger.Config{
+ Format: "[${ip}]:${port} ${status} - ${method} ${path}\n",
+ }))
+ hosts["blog.localhost:3000"] = &Host{blog}
+ blog.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Blog")
+ })
+ //---------
+ // Website
+ //---------
+ site := fiber.New()
+ site.Use(logger.New(logger.Config{
+ Format: "[${ip}]:${port} ${status} - ${method} ${path}\n",
+ }))
+
+ hosts["localhost:3000"] = &Host{site}
+ site.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Website")
+ })
+ // Server
+ app := fiber.New()
+ app.Use(func(c *fiber.Ctx) error {
+ host := hosts[c.Hostname()]
+ if host == nil {
+ return c.SendStatus(fiber.StatusNotFound)
+ } else {
+ host.Fiber.Handler()(c.Context())
+ return nil
+ }
+ })
+ log.Fatal(app.Listen(":3000"))
+}
+```
+If more information is needed, please refer to this issue [#750](https://github.com/gofiber/fiber/issues/750)
diff --git a/docs/guide/_category_.json b/docs/guide/_category_.json
new file mode 100644
index 0000000..b0e157a
--- /dev/null
+++ b/docs/guide/_category_.json
@@ -0,0 +1,8 @@
+{
+ "label": "Guide",
+ "position": 3,
+ "link": {
+ "type": "generated-index",
+ "description": "Guides for Fiber."
+ }
+}
diff --git a/docs/guide/error-handling.md b/docs/guide/error-handling.md
new file mode 100644
index 0000000..7d3aa36
--- /dev/null
+++ b/docs/guide/error-handling.md
@@ -0,0 +1,128 @@
+---
+id: error-handling
+title: 🐛 Error Handling
+description: >-
+ Fiber supports centralized error handling by returning an error to the handler
+ which allows you to log errors to external services or send a customized HTTP
+ response to the client.
+sidebar_position: 4
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+## Catching Errors
+
+It’s essential to ensure that Fiber catches all errors that occur while running route handlers and middleware. You must return them to the handler function, where Fiber will catch and process them.
+
+
+
+
+```go
+app.Get("/", func(c *fiber.Ctx) error {
+ // Pass error to Fiber
+ return c.SendFile("file-does-not-exist")
+})
+```
+
+
+
+Fiber does not handle [panics](https://go.dev/blog/defer-panic-and-recover) by default. To recover from a panic thrown by any handler in the stack, you need to include the `Recover` middleware below:
+
+```go title="Example"
+package main
+
+import (
+ "log"
+
+ "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("This panic is caught by fiber")
+ })
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+You could use Fiber's custom error struct to pass an additional `status code` using `fiber.NewError()`. It's optional to pass a message; if this is left empty, it will default to the status code message \(`404` equals `Not Found`\).
+
+```go title="Example"
+app.Get("/", func(c *fiber.Ctx) error {
+ // 503 Service Unavailable
+ return fiber.ErrServiceUnavailable
+
+ // 503 On vacation!
+ return fiber.NewError(fiber.StatusServiceUnavailable, "On vacation!")
+})
+```
+
+## Default Error Handler
+
+Fiber provides an error handler by default. For a standard error, the response is sent as **500 Internal Server Error**. If the error is of type [fiber.Error](https://godoc.org/github.com/gofiber/fiber#Error), the response is sent with the provided status code and message.
+
+```go title="Example"
+// Default error handler
+var DefaultErrorHandler = func(c *fiber.Ctx, err error) error {
+ // Status code defaults to 500
+ code := fiber.StatusInternalServerError
+
+ // Retrieve the custom status code if it's a *fiber.Error
+ var e *fiber.Error
+ if errors.As(err, &e) {
+ code = e.Code
+ }
+
+ // Set Content-Type: text/plain; charset=utf-8
+ c.Set(fiber.HeaderContentType, fiber.MIMETextPlainCharsetUTF8)
+
+ // Return status code with error message
+ return c.Status(code).SendString(err.Error())
+}
+```
+
+## Custom Error Handler
+
+A custom error handler can be set using a [Config ](../api/fiber.md#config)when initializing a [Fiber instance](../api/fiber.md#new).
+
+In most cases, the default error handler should be sufficient. However, a custom error handler can come in handy if you want to capture different types of errors and take action accordingly e.g., send a notification email or log an error to the centralized system. You can also send customized responses to the client e.g., error page or just a JSON response.
+
+The following example shows how to display error pages for different types of errors.
+
+```go title="Example"
+// Create a new fiber instance with custom config
+app := fiber.New(fiber.Config{
+ // Override default error handler
+ ErrorHandler: func(ctx *fiber.Ctx, err error) error {
+ // Status code defaults to 500
+ code := fiber.StatusInternalServerError
+
+ // Retrieve the custom status code if it's a *fiber.Error
+ var e *fiber.Error
+ if errors.As(err, &e) {
+ code = e.Code
+ }
+
+ // Send custom error page
+ err = ctx.Status(code).SendFile(fmt.Sprintf("./%d.html", code))
+ if err != nil {
+ // In case the SendFile fails
+ return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
+ }
+
+ // Return from handler
+ return nil
+ },
+})
+
+// ...
+```
+
+> Special thanks to the [Echo](https://echo.labstack.com/) & [Express](https://expressjs.com/) framework for inspiration regarding error handling.
diff --git a/docs/guide/faster-fiber.md b/docs/guide/faster-fiber.md
new file mode 100644
index 0000000..b0b7bcb
--- /dev/null
+++ b/docs/guide/faster-fiber.md
@@ -0,0 +1,36 @@
+---
+id: faster-fiber
+title: ⚡ Make Fiber Faster
+sidebar_position: 7
+---
+
+## Custom JSON Encoder/Decoder
+Since Fiber v2.32.0, we use **encoding/json** as default json library due to stability and producibility. However, the standard library is a bit slow compared to 3rd party libraries. If you're not happy with the performance of **encoding/json**, we recommend you to use these libraries:
+- [goccy/go-json](https://github.com/goccy/go-json)
+- [bytedance/sonic](https://github.com/bytedance/sonic)
+- [segmentio/encoding](https://github.com/segmentio/encoding)
+- [mailru/easyjson](https://github.com/mailru/easyjson)
+- [minio/simdjson-go](https://github.com/minio/simdjson-go)
+- [wI2L/jettison](https://github.com/wI2L/jettison)
+
+```go title="Example"
+package main
+
+import "github.com/gofiber/fiber/v2"
+import "github.com/goccy/go-json"
+
+func main() {
+ app := fiber.New(fiber.Config{
+ JSONEncoder: json.Marshal,
+ JSONDecoder: json.Unmarshal,
+ })
+
+ # ...
+}
+```
+
+### References
+- [Set custom JSON encoder for client](../api/client.md#jsonencoder)
+- [Set custom JSON decoder for client](../api/client.md#jsondecoder)
+- [Set custom JSON encoder for application](../api/fiber.md#config)
+- [Set custom JSON decoder for application](../api/fiber.md#config)
\ No newline at end of file
diff --git a/docs/guide/grouping.md b/docs/guide/grouping.md
new file mode 100644
index 0000000..429e170
--- /dev/null
+++ b/docs/guide/grouping.md
@@ -0,0 +1,79 @@
+---
+id: grouping
+title: 🎭 Grouping
+sidebar_position: 2
+---
+
+:::info
+In general, the Group functionality in Fiber behaves similarly to ExpressJS. Groups are declared virtually and all routes declared within the group are flattened into a single list with a prefix, which is then checked by the framework in the order it was declared. This means that the behavior of Group in Fiber is identical to that of ExpressJS.
+:::
+
+## Paths
+
+Like **Routing**, groups can also have paths that belong to a cluster.
+
+```go
+func main() {
+ app := fiber.New()
+
+ api := app.Group("/api", middleware) // /api
+
+ v1 := api.Group("/v1", middleware) // /api/v1
+ v1.Get("/list", handler) // /api/v1/list
+ v1.Get("/user", handler) // /api/v1/user
+
+ v2 := api.Group("/v2", middleware) // /api/v2
+ v2.Get("/list", handler) // /api/v2/list
+ v2.Get("/user", handler) // /api/v2/user
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+A **Group** of paths can have an optional handler.
+
+```go
+func main() {
+ app := fiber.New()
+
+ api := app.Group("/api") // /api
+
+ v1 := api.Group("/v1") // /api/v1
+ v1.Get("/list", handler) // /api/v1/list
+ v1.Get("/user", handler) // /api/v1/user
+
+ v2 := api.Group("/v2") // /api/v2
+ v2.Get("/list", handler) // /api/v2/list
+ v2.Get("/user", handler) // /api/v2/user
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+:::caution
+Running **/api**, **/v1** or **/v2** will result in **404** error, make sure you have the errors set.
+:::
+
+## Group Handlers
+
+Group handlers can also be used as a routing path but they must have **Next** added to them so that the flow can continue.
+
+```go
+func main() {
+ app := fiber.New()
+
+ handler := func(c *fiber.Ctx) error {
+ return c.SendStatus(fiber.StatusOK)
+ }
+ api := app.Group("/api") // /api
+
+ v1 := api.Group("/v1", func(c *fiber.Ctx) error { // middleware for /api/v1
+ c.Set("Version", "v1")
+ return c.Next()
+ })
+ v1.Get("/list", handler) // /api/v1/list
+ v1.Get("/user", handler) // /api/v1/user
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
diff --git a/docs/guide/hooks.md b/docs/guide/hooks.md
new file mode 100644
index 0000000..357d59d
--- /dev/null
+++ b/docs/guide/hooks.md
@@ -0,0 +1,218 @@
+---
+id: hooks
+title: 🎣 Hooks
+sidebar_position: 6
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+With Fiber v2.30.0, you can execute custom user functions when to run some methods. Here is a list of this hooks:
+- [OnRoute](#onroute)
+- [OnName](#onname)
+- [OnGroup](#ongroup)
+- [OnGroupName](#ongroupname)
+- [OnListen](#onlisten)
+- [OnFork](#onfork)
+- [OnShutdown](#onshutdown)
+- [OnMount](#onmount)
+
+## Constants
+```go
+// Handlers define a function to create hooks for Fiber.
+type OnRouteHandler = func(Route) error
+type OnNameHandler = OnRouteHandler
+type OnGroupHandler = func(Group) error
+type OnGroupNameHandler = OnGroupHandler
+type OnListenHandler = func(ListenData) error
+type OnForkHandler = func(int) error
+type OnShutdownHandler = func() error
+type OnMountHandler = func(*App) error
+```
+
+## OnRoute
+
+OnRoute is a hook to execute user functions on each route registeration. Also you can get route properties by **route** parameter.
+
+```go title="Signature"
+func (h *Hooks) OnRoute(handler ...OnRouteHandler)
+```
+
+## OnName
+
+OnName is a hook to execute user functions on each route naming. Also you can get route properties by **route** parameter.
+
+:::caution
+OnName only works with naming routes, not groups.
+:::
+
+```go title="Signature"
+func (h *Hooks) OnName(handler ...OnNameHandler)
+```
+
+
+
+
+```go
+package main
+
+import (
+ "fmt"
+
+ "github.com/gofiber/fiber/v2"
+)
+
+func main() {
+ app := fiber.New()
+
+ app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString(c.Route().Name)
+ }).Name("index")
+
+ app.Hooks().OnName(func(r fiber.Route) error {
+ fmt.Print("Name: " + r.Name + ", ")
+
+ return nil
+ })
+
+ app.Hooks().OnName(func(r fiber.Route) error {
+ fmt.Print("Method: " + r.Method + "\n")
+
+ return nil
+ })
+
+ app.Get("/add/user", func(c *fiber.Ctx) error {
+ return c.SendString(c.Route().Name)
+ }).Name("addUser")
+
+ app.Delete("/destroy/user", func(c *fiber.Ctx) error {
+ return c.SendString(c.Route().Name)
+ }).Name("destroyUser")
+
+ app.Listen(":5000")
+}
+
+// Results:
+// Name: addUser, Method: GET
+// Name: destroyUser, Method: DELETE
+```
+
+
+
+## OnGroup
+
+OnGroup is a hook to execute user functions on each group registeration. Also you can get group properties by **group** parameter.
+
+```go title="Signature"
+func (h *Hooks) OnGroup(handler ...OnGroupHandler)
+```
+
+## OnGroupName
+
+OnGroupName is a hook to execute user functions on each group naming. Also you can get group properties by **group** parameter.
+
+:::caution
+OnGroupName only works with naming groups, not routes.
+:::
+
+```go title="Signature"
+func (h *Hooks) OnGroupName(handler ...OnGroupNameHandler)
+```
+
+## OnListen
+
+OnListen is a hook to execute user functions on Listen, ListenTLS, Listener.
+
+```go title="Signature"
+func (h *Hooks) OnListen(handler ...OnListenHandler)
+```
+
+
+
+
+```go
+app := fiber.New(fiber.Config{
+ DisableStartupMessage: true,
+})
+
+app.Hooks().OnListen(func(listenData fiber.ListenData) error {
+ if fiber.IsChild() {
+ return nil
+ }
+ scheme := "http"
+ if data.TLS {
+ scheme = "https"
+ }
+ log.Println(scheme + "://" + listenData.Host + ":" + listenData.Port)
+ return nil
+})
+
+app.Listen(":5000")
+```
+
+
+
+
+## OnFork
+
+OnFork is a hook to execute user functions on Fork.
+
+```go title="Signature"
+func (h *Hooks) OnFork(handler ...OnForkHandler)
+```
+
+## OnShutdown
+
+OnShutdown is a hook to execute user functions after Shutdown.
+
+```go title="Signature"
+func (h *Hooks) OnShutdown(handler ...OnShutdownHandler)
+```
+
+## OnMount
+
+OnMount is a hook to execute user function after mounting process. The mount event is fired when sub-app is mounted on a parent app. The parent app is passed as a parameter. It works for app and group mounting.
+
+```go title="Signature"
+func (h *Hooks) OnMount(handler ...OnMountHandler)
+```
+
+
+
+
+```go
+package main
+
+import (
+ "fmt"
+
+ "github.com/gofiber/fiber/v2"
+)
+
+func main() {
+ app := New()
+ app.Get("/", testSimpleHandler).Name("x")
+
+ subApp := New()
+ subApp.Get("/test", testSimpleHandler)
+
+ subApp.Hooks().OnMount(func(parent *fiber.App) error {
+ fmt.Print("Mount path of parent app: "+parent.MountPath())
+ // ...
+
+ return nil
+ })
+
+ app.Mount("/sub", subApp)
+}
+
+// Result:
+// Mount path of parent app:
+```
+
+
+
+
+
+:::caution
+OnName/OnRoute/OnGroup/OnGroupName hooks are mount-sensitive. If you use one of these routes on sub app and you mount it; paths of routes and groups will start with mount prefix.
diff --git a/docs/guide/routing.md b/docs/guide/routing.md
new file mode 100644
index 0000000..dbb92dc
--- /dev/null
+++ b/docs/guide/routing.md
@@ -0,0 +1,294 @@
+---
+id: routing
+title: 🔌 Routing
+description: >-
+ Routing refers to how an application's endpoints (URIs) respond to client
+ requests.
+sidebar_position: 1
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+import RoutingHandler from './../partials/routing/handler.md';
+
+## Handlers
+
+
+
+## Paths
+
+Route paths, combined with a request method, define the endpoints at which requests can be made. Route paths can be **strings** or **string patterns**.
+
+**Examples of route paths based on strings**
+
+```go
+// This route path will match requests to the root route, "/":
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("root")
+})
+
+// This route path will match requests to "/about":
+app.Get("/about", func(c *fiber.Ctx) error {
+ return c.SendString("about")
+})
+
+// This route path will match requests to "/random.txt":
+app.Get("/random.txt", func(c *fiber.Ctx) error {
+ return c.SendString("random.txt")
+})
+```
+
+As with the expressJs framework, the order of the route declaration plays a role.
+When a request is received, the routes are checked in the order in which they are declared.
+
+:::info
+So please be careful to write routes with variable parameters after the routes that contain fixed parts, so that these variable parts do not match instead and unexpected behavior occurs.
+:::
+
+## Parameters
+
+Route parameters are dynamic elements in the route, which are **named** or **not named segments**. This segments that are used to capture the values specified at their position in the URL. The obtained values can be retrieved using the [Params](https://fiber.wiki/context#params) function, with the name of the route parameter specified in the path as their respective keys or for unnamed parameters the character\(\*, +\) and the counter of this.
+
+The characters :, +, and \* are characters that introduce a parameter.
+
+Greedy parameters are indicated by wildcard\(\*\) or plus\(+\) signs.
+
+The routing also offers the possibility to use optional parameters, for the named parameters these are marked with a final "?", unlike the plus sign which is not optional, you can use the wildcard character for a parameter range which is optional and greedy.
+
+**Example of define routes with route parameters**
+
+```go
+// Parameters
+app.Get("/user/:name/books/:title", func(c *fiber.Ctx) error {
+ fmt.Fprintf(c, "%s\n", c.Params("name"))
+ fmt.Fprintf(c, "%s\n", c.Params("title"))
+ return nil
+})
+// Plus - greedy - not optional
+app.Get("/user/+", func(c *fiber.Ctx) error {
+ return c.SendString(c.Params("+"))
+})
+
+// Optional parameter
+app.Get("/user/:name?", func(c *fiber.Ctx) error {
+ return c.SendString(c.Params("name"))
+})
+
+// Wildcard - greedy - optional
+app.Get("/user/*", func(c *fiber.Ctx) error {
+ return c.SendString(c.Params("*"))
+})
+
+// This route path will match requests to "/v1/some/resource/name:customVerb", since the parameter character is escaped
+app.Get(`/v1/some/resource/name\:customVerb`, func(c *fiber.Ctx) error {
+ return c.SendString("Hello, Community")
+})
+```
+
+:::info
+Since the hyphen \(`-`\) and the dot \(`.`\) are interpreted literally, they can be used along with route parameters for useful purposes.
+:::
+
+:::info
+All special parameter characters can also be escaped with `"\\"` and lose their value, so you can use them in the route if you want, like in the custom methods of the [google api design guide](https://cloud.google.com/apis/design/custom_methods). It's recommended to use backticks `` ` `` because in go's regex documentation, they always use backticks to make sure it is unambiguous and the escape character doesn't interfere with regex patterns in an unexpected way.
+:::
+
+```go
+// http://localhost:3000/plantae/prunus.persica
+app.Get("/plantae/:genus.:species", func(c *fiber.Ctx) error {
+ fmt.Fprintf(c, "%s.%s\n", c.Params("genus"), c.Params("species"))
+ return nil // prunus.persica
+})
+```
+
+```go
+// http://localhost:3000/flights/LAX-SFO
+app.Get("/flights/:from-:to", func(c *fiber.Ctx) error {
+ fmt.Fprintf(c, "%s-%s\n", c.Params("from"), c.Params("to"))
+ return nil // LAX-SFO
+})
+```
+
+Our intelligent router recognizes that the introductory parameter characters should be part of the request route in this case and can process them as such.
+
+```go
+// http://localhost:3000/shop/product/color:blue/size:xs
+app.Get("/shop/product/color::color/size::size", func(c *fiber.Ctx) error {
+ fmt.Fprintf(c, "%s:%s\n", c.Params("color"), c.Params("size"))
+ return nil // blue:xs
+})
+```
+
+In addition, several parameters in a row and several unnamed parameter characters in the route, such as the wildcard or plus character, are possible, which greatly expands the possibilities of the router for the user.
+
+```go
+// GET /@v1
+// Params: "sign" -> "@", "param" -> "v1"
+app.Get("/:sign:param", handler)
+
+// GET /api-v1
+// Params: "name" -> "v1"
+app.Get("/api-:name", handler)
+
+// GET /customer/v1/cart/proxy
+// Params: "*1" -> "customer/", "*2" -> "/cart"
+app.Get("/*v1*/proxy", handler)
+
+// GET /v1/brand/4/shop/blue/xs
+// Params: "*1" -> "brand/4", "*2" -> "blue/xs"
+app.Get("/v1/*/shop/*", handler)
+```
+
+We have adapted the routing strongly to the express routing, but currently without the possibility of the regular expressions, because they are quite slow. The possibilities can be tested with version 0.1.7 \(express 4\) in the online [Express route tester](http://forbeslindesay.github.io/express-route-tester/).
+
+### Constraints
+Route constraints execute when a match has occurred to the incoming URL and the URL path is tokenized into route values by parameters. The feature was intorduced in `v2.37.0` and inspired by [.NET Core](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-6.0#route-constraints).
+
+:::caution
+Constraints aren't validation for parameters. If constraints aren't valid for a parameter value, Fiber returns **404 handler**.
+:::
+
+| Constraint | Example | Example matches |
+| ----------------- | ------------------------------------ | ------------------------------------------------------------------------------------------- |
+| int | `:id` | 123456789, -123456789 |
+| bool | `:active` | true,false |
+| guid | `:id` | CD2C1638-1638-72D5-1638-DEADBEEF1638 |
+| float | `:weight` | 1.234, -1,001.01e8 |
+| minLen(value) | `:username` | Test (must be at least 4 characters) |
+| maxLen(value) | `:filename` | MyFile (must be no more than 8 characters |
+| len(length) | `:filename` | somefile.txt (exactly 12 characters) |
+| min(value) | `:age` | 19 (Integer value must be at least 18) |
+| max(value) | `:age` | 91 (Integer value must be no more than 120) |
+| range(min,max) | `:age` | 91 (Integer value must be at least 18 but no more than 120) |
+| alpha | `:name` | Rick (String must consist of one or more alphabetical characters, a-z and case-insensitive) |
+| datetime | `:dob` | 2005-11-01 |
+| regex(expression) | `:date` | 2022-08-27 (Must match regular expression) |
+
+**Examples**
+
+
+
+
+```go
+app.Get("/:test", func(c *fiber.Ctx) error {
+ return c.SendString(c.Params("test"))
+})
+
+// curl -X GET http://localhost:3000/12
+// 12
+
+// curl -X GET http://localhost:3000/1
+// Cannot GET /1
+```
+
+
+
+You can use `;` for multiple constraints.
+```go
+app.Get("/:test", func(c *fiber.Ctx) error {
+ return c.SendString(c.Params("test"))
+})
+
+// curl -X GET http://localhost:3000/120000
+// Cannot GET /120000
+
+// curl -X GET http://localhost:3000/1
+// Cannot GET /1
+
+// curl -X GET http://localhost:3000/250
+// 250
+```
+
+
+
+Fiber precompiles regex query when to register routes. So there're no performance overhead for regex constraint.
+```go
+app.Get(`/:date`, func(c *fiber.Ctx) error {
+ return c.SendString(c.Params("date"))
+})
+
+// curl -X GET http://localhost:3000/125
+// Cannot GET /125
+
+// curl -X GET http://localhost:3000/test
+// Cannot GET /test
+
+// curl -X GET http://localhost:3000/2022-08-27
+// 2022-08-27
+```
+
+
+
+
+:::caution
+You should use `\\` before routing-specific characters when to use datetime constraint (`*`, `+`, `?`, `:`, `/`, `<`, `>`, `;`, `(`, `)`), to avoid wrong parsing.
+:::
+
+**Optional Parameter Example**
+
+You can impose constraints on optional parameters as well.
+
+```go
+app.Get("/:test?", func(c *fiber.Ctx) error {
+ return c.SendString(c.Params("test"))
+})
+// curl -X GET http://localhost:3000/42
+// 42
+// curl -X GET http://localhost:3000/
+//
+// curl -X GET http://localhost:3000/7.0
+// Cannot GET /7.0
+```
+
+## Middleware
+
+Functions that are designed to make changes to the request or response are called **middleware functions**. The [Next](../api/ctx.md#next) is a **Fiber** router function, when called, executes the **next** function that **matches** the current route.
+
+**Example of a middleware function**
+
+```go
+app.Use(func(c *fiber.Ctx) error {
+ // Set a custom header on all responses:
+ c.Set("X-Custom-Header", "Hello, World")
+
+ // Go to next middleware:
+ return c.Next()
+})
+
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.SendString("Hello, World!")
+})
+```
+
+`Use` method path is a **mount**, or **prefix** path, and limits middleware to only apply to any paths requested that begin with it.
+
+### Constraints on Adding Routes Dynamically
+
+:::caution
+Adding routes dynamically after the application has started is not supported due to design and performance considerations. Make sure to define all your routes before the application starts.
+:::
+
+
+## Grouping
+
+If you have many endpoints, you can organize your routes using `Group`.
+
+```go
+func main() {
+ app := fiber.New()
+
+ api := app.Group("/api", middleware) // /api
+
+ v1 := api.Group("/v1", middleware) // /api/v1
+ v1.Get("/list", handler) // /api/v1/list
+ v1.Get("/user", handler) // /api/v1/user
+
+ v2 := api.Group("/v2", middleware) // /api/v2
+ v2.Get("/list", handler) // /api/v2/list
+ v2.Get("/user", handler) // /api/v2/user
+
+ log.Fatal(app.Listen(":3000"))
+}
+```
+
+More information about this in our [Grouping Guide](./grouping.md)
diff --git a/docs/guide/templates.md b/docs/guide/templates.md
new file mode 100644
index 0000000..18dd0e3
--- /dev/null
+++ b/docs/guide/templates.md
@@ -0,0 +1,267 @@
+---
+id: templates
+title: 📝 Templates
+description: Fiber supports server-side template engines.
+sidebar_position: 3
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+Templates are a great tool to render dynamic content without using a separate frontend framework.
+
+## Template Engines
+
+Fiber allows you to provide a custom template engine at app initialization.
+
+```go
+app := fiber.New(fiber.Config{
+ // Pass in Views Template Engine
+ Views: engine,
+
+ // Default global path to search for views (can be overriden when calling Render())
+ ViewsLayout: "layouts/main",
+
+ // Enables/Disables access to `ctx.Locals()` entries in rendered views
+ // (defaults to false)
+ PassLocalsToViews: false,
+})
+```
+
+### Supported Engines
+
+The Fiber team maintains a [templates](https://docs.gofiber.io/template) package that provides wrappers for multiple template engines:
+
+* [ace](https://docs.gofiber.io/template/ace/)
+* [amber](https://docs.gofiber.io/template/amber/)
+* [django](https://docs.gofiber.io/template/django/)
+* [handlebars](https://docs.gofiber.io/template/handlebars)
+* [html](https://docs.gofiber.io/template/html)
+* [jet](https://docs.gofiber.io/template/jet)
+* [mustache](https://docs.gofiber.io/template/mustache)
+* [pug](https://docs.gofiber.io/template/pug)
+* [slim](https://docs.gofiber.io/template/slim)
+
+:::info
+Custom template engines can implement the `Views` interface to be supported in Fiber.
+:::
+
+```go title="Views interface"
+type Views interface {
+ // Fiber executes Load() on app initialization to load/parse the templates
+ Load() error
+
+ // Outputs a template to the provided buffer using the provided template,
+ // template name, and binded data
+ Render(io.Writer, string, interface{}, ...string) error
+}
+```
+
+:::note
+The `Render` method is linked to the [**ctx.Render\(\)**](../api/ctx.md#render) function that accepts a template name and binding data.
+:::
+
+## Rendering Templates
+
+Once an engine is set up, a route handler can call the [**ctx.Render\(\)**](../api/ctx.md#render) function with a template name and binded data to send the rendered template.
+
+```go title="Signature"
+func (c *Ctx) Render(name string, bind Map, layouts ...string) error
+```
+
+:::info
+By default, [**ctx.Render\(\)**](../api/ctx.md#render) searches for the template name in the `ViewsLayout` path. To override this setting, provide the path(s) in the `layouts` argument.
+:::
+
+
+
+
+```go
+app.Get("/", func(c *fiber.Ctx) error {
+ return c.Render("index", fiber.Map{
+ "Title": "Hello, World!",
+ })
+
+})
+```
+
+
+
+
+
+```html
+
+
+
+
{{.Title}}
+
+
+```
+
+
+
+
+
+:::caution
+If the Fiber config option `PassLocalsToViews` is enabled, then all locals set using `ctx.Locals(key, value)` will be passed to the template. It is important to avoid clashing keys when using this setting.
+:::
+
+## Advanced Templating
+
+### Custom Functions
+
+Fiber supports adding custom functions to templates.
+
+#### AddFunc
+
+Adds a global function to all templates.
+
+```go title="Signature"
+func (e *Engine) AddFunc(name string, fn interface{}) IEngineCore
+```
+
+
+
+
+```go
+// Add `ToUpper` to engine
+engine := html.New("./views", ".html")
+engine.AddFunc("ToUpper", func(s string) string {
+ return strings.ToUpper(s)
+}
+
+// Initialize Fiber App
+app := fiber.New(fiber.Config{
+ Views: engine,
+})
+
+app.Get("/", func (c *fiber.Ctx) error {
+ return c.Render("index", fiber.Map{
+ "Content": "hello, world!"
+ })
+})
+```
+
+
+
+
+```html
+
+
+
+