{"id":18023567,"url":"https://github.com/jeffotoni/quick","last_synced_at":"2025-04-07T09:15:40.282Z","repository":{"id":79217296,"uuid":"604347970","full_name":"jeffotoni/quick","owner":"jeffotoni","description":"It is a route manager 100% using net/http, it is being born and is under development, it is intended to be fast and with high performance.","archived":false,"fork":false,"pushed_at":"2025-04-01T02:36:50.000Z","size":7190,"stargazers_count":116,"open_issues_count":5,"forks_count":12,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-01T03:27:55.697Z","etag":null,"topics":["api-rest","curl-command","digest-authentication","go","go-library","go-router","golang","golang-library","golang-router","hacktoberfest","hacktoberfest2023","http-client","middleware","quick","rest-client","retry-backoff"],"latest_commit_sha":null,"homepage":"https://goquick.run","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeffotoni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-20T21:42:56.000Z","updated_at":"2025-04-01T02:36:54.000Z","dependencies_parsed_at":"2023-12-01T20:28:07.372Z","dependency_job_id":"94ff0771-a89b-4dce-b093-f7b7b228e6db","html_url":"https://github.com/jeffotoni/quick","commit_stats":null,"previous_names":["gojeffotoni/quick","jeffotoni/goquick"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffotoni%2Fquick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffotoni%2Fquick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffotoni%2Fquick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffotoni%2Fquick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeffotoni","download_url":"https://codeload.github.com/jeffotoni/quick/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247622988,"owners_count":20968575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-rest","curl-command","digest-authentication","go","go-library","go-router","golang","golang-library","golang-router","hacktoberfest","hacktoberfest2023","http-client","middleware","quick","rest-client","retry-backoff"],"created_at":"2024-10-30T07:09:55.921Z","updated_at":"2025-04-07T09:15:40.268Z","avatar_url":"https://github.com/jeffotoni.png","language":"Go","readme":"![Logo do Quick](./quick_logo.png)\n\n[![GoDoc](https://godoc.org/github.com/jeffotoni/quick?status.svg)](https://godoc.org/github.com/jeffotoni/quick) [![CircleCI](https://dl.circleci.com/status-badge/img/gh/jeffotoni/quick/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/jeffotoni/quick/tree/main) [![Go Report](https://goreportcard.com/badge/github.com/jeffotoni/quick)](https://goreportcard.com/badge/github.com/jeffotoni/quick) [![License](https://img.shields.io/github/license/jeffotoni/quick)](https://img.shields.io/github/license/jeffotoni/quick) ![CircleCI](https://img.shields.io/circleci/build/github/jeffotoni/quick/main) ![Coveralls](https://img.shields.io/coverallsCoverage/github/jeffotoni/quick) ![GitHub contributors](https://img.shields.io/github/contributors/jeffotoni/quick)\n![GitHub stars](https://img.shields.io/github/last-commit/jeffotoni/quick) ![GitHub stars](https://img.shields.io/github/forks/jeffotoni/quick?style=social) ![GitHub stars](https://img.shields.io/github/stars/jeffotoni/quick)\n\n\u003c!-- [![Github Release](https://img.shields.io/github/v/release/jeffotoni/quick?include_prereleases)](https://img.shields.io/github/v/release/jeffotoni/quick) --\u003e\n\n\n```bash\n   ██████╗ ██╗   ██╗██╗ ██████╗██╗  ██╗\n  ██╔═══██╗██║   ██║██║██╔═══   ██║ ██╔╝\n  ██║   ██║██║   ██║██║██║      █████╔╝\n  ██║▄▄ ██║██║   ██║██║██║      ██╔═██╗\n  ╚██████╔╝╚██████╔╝██║╚██████╔ ██║  ██╗\n   ╚══▀▀═╝  ╚═════╝ ╚═╝ ╚═════╝ ╚═╝  ╚═╝\n\n Quick v0.0.1 🚀 Fast \u0026 Minimal Web Framework\n─────────────────── ───────────────────────────────\n 🌎 Host : http://0.0.0.0\n 📌 Port : 8080\n 🔀 Routes: 4\n─────────────────── ───────────────────────────────\n\n```\n\n# Quick - a lightweight router for go ![Quick Logo](./quick.png)\n\n🚀 Quick is a **flexible and extensible** route manager for the Go language. Its goal is to be **fast and high-performance**, as well as being **100% compatible with net/http**. Quick is a **project in constant development** and is open for **collaboration**, everyone is welcome to contribute. 😍\n\n💡 If you’re new to coding, Quick is a great opportunity to start learning how to work with Go. With its **ease of use** and features, you can **create custom routes** and expand your knowledge of the language.\n\n👍 I hope you can participate and enjoy **Enjoy**! 😍\n\n🔍 The repository of examples of the Framework Quick Run [Examples](https://github.com/jeffotoni/quick/tree/main/example).\n\n# Quick in action 💕🐧🚀😍\n\n![Quick](quick_server.gif)\n\n---\n\n## 📦 Go Packages Documentation\n\nTo access the documentation for each **Quick Framework** package, click on the links below:\n\n| Package                | Description                                       | Go.dev                                                                                                                                    |\n| ---------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |\n| **quick**              | Main Router and Framework Features                | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick)                        |\n| **quick/http/client**  | HTTP client optimized for requests and failover   | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick/http/client.svg)](https://pkg.go.dev/github.com/jeffotoni/quick/http/client) |\n| **quick/middleware**   | Framework middlewares                             | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick/middleware.svg)](https://pkg.go.dev/github.com/jeffotoni/quick/middleware)  |\n| **quick/ctx**          | HTTP request and response context                 | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick#Ctx)                    |\n| **quick/http/status**  | HTTP status definitions in the framework          | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick#Status)                 |\n| **quick/group**        | Route group manipulation                          | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick#Group)                  |\n| **quickTest**          | Package for unit testing and integration in Quick | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick/quickTest.svg)](https://pkg.go.dev/github.com/jeffotoni/quickTest)          |\n| **quick/route**        | Route definition and management                   | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick#Route)                  |\n| **quick/config**       | Framework configuration structures                | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick#Config)                 |\n| **quick/qtest**        | Auxiliary tools for testing in the Quick          | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick#QTest)                  |\n| **quick/uploadedFile** | File upload management                            | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick#UploadedFile)           |\n| **quick/zeroth**       | Framework helpers                                 | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick#Zeroth)                 |\n| **quick/template**       | Template                                | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick@v0.0.0-20250327050516-ae83fc2d0fa1/template)      \n| **quick/benchmarks**       | Benchmarks                                | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick@v0.0.0-20250327050516-ae83fc2d0fa1/benchmarks)            |\n| **quick/example**       | Usage examples                                | [![GoDoc](https://pkg.go.dev/badge/github.com/jeffotoni/quick.svg)](https://pkg.go.dev/github.com/jeffotoni/quick@v0.0.0-20250327050516-ae83fc2d0fa1/example)   \n\n\n---\n\n## 🎛️| Features\n\n| Features                                       | Has | Status | Completion |\n| ---------------------------------------------- | --- | ------ | ---------- |\n| 🛣️ Route Manager                               | yes | 🟢     | 100%       |\n| 📁 Server Files Static                         | yes | 🟢     | 100%       |\n| 🔗 Http Client                                 | yes | 🟢     | 100%       |\n| 📤 Upload Files (multipart/form-data)          | yes | 🟢     | 100%       |\n| 🚪 Route Group                                 | yes | 🟢     | 100%       |\n| 🛡️ Middlewares                                 | yes | 🟡     | 50%        |\n| ⚡ HTTP/2 support                              | yes |  🟢     | 100%       |\n| 🔄 Data binding for JSON, XML and form payload | yes | 🟢     | 100%       |\n| 🔍 Regex support                               | yes | 🟡     | 80%        |\n| 🌎 Website                                     | yes | 🟡     | 90%        |\n| 📚 Documentation                               | yes | 🟡     | 40%        |\n| 🧩 Template Engine with Layout Support         | yes | 🟢     | 100%       |\n| 📦 Embedded Template Support (`embed.FS`)      | yes | 🟢     | 100%       |\n| 🔧 Custom Template Functions (`AddFunc`)       | yes | 🟢     | 100%       |\n| 🧪 Built-in Test Engine (`Qtest`)              | yes | 🟢     | 100%       |\n| 🧵 Middleware: Rate Limiting                   | yes | 🟢     | 100%       |\n| 🧵 Middleware: Logger                          | yes | 🟢     | 100%       |\n| 🧵 Middleware: Recover (panic handler)         | yes | 🟢     | 100%       |\n| 🧵 Middleware: CORS                            | yes | 🟢     | 100%       |\n| 🧵 Middleware: Helmet (security headers)       | yes | 🟢     | 100%       |\n| 🧵 Middleware: MaxBody                         | yes | 🟢     | 100%       |\n| 🔐 Middleware: BasicAuth                       | yes | 🟢     | 100%       |\n| 🧠 Middleware: PPROF                       | yes | 🟢     | 100%       |\n| 🛠️ Healthcheck Middleware                     | yes | 🟢     | 100%       |\n| 🚀 Performance Optimized Routing               | yes | 🟢     | 100%       |\n| 🧱 Extensible Plugin/Middleware System         | yes | 🟡     | 60%        |\n\n# 🗺️ Development Roadmap  \n\n## ✅ Completed Tasks  \n\n| Task                                                                      | Progress |\n| ------------------------------------------------------------------------- | -------- |\n| Develop MaxBodySize method Post                                           | ✅ 100%  |\n| Develop MaxBodySize method Put                                            | ✅ 100%  |\n| Develop Config in New(Config{}) not required                              | ✅ 100%  |\n| Create print function to not use fmt too much                             | ✅ 100%  |\n| Creation of own function for Concat String                                | ✅ 100%  |\n| Creation of benchmarking between the Stdout and fmt.Println               | ✅ 100%  |\n| Develop Routes GET method                                                 | ✅ 100%  |\n| Develop Routes GET method by accepting Query String                       | ✅ 100%  |\n| Develop Routes GET method accepting Parameters                            | ✅ 100%  |\n| Develop Routes GET method accepting Query String and Parameters           | ✅ 100%  |\n| Develop Routes GET method accepting regular expression                    | ✅ 100%  |\n| Develop Routes Method POST                                                | ✅ 100%  |\n| Develop Routes POST method accepting JSON                                 | ✅ 100%  |\n| Develop for METHOD POST the parse JSON                                    | ✅ 100%  |\n| Develop for the POST METHOD functions to access byte or string from Parse | ✅ 100%  |\n| Develop for PUT METHOD                                                    | ✅ 100%  |\n| Develop for the PUT METHOD the JSON parse                                 | ✅ 100%  |\n| Develop for the PUT METHOD the JSON parse                                 | ✅ 100%  |\n| Develop for METHOD PUT functions to access byte or string from the Parse  | ✅ 100%  |\n| Develop for DELETE METHOD                                                 | ✅ 100%  |\n| Develop method for ListenAndServe                                         | ✅ 100%  |\n| Develop ServeHTTP support                                                 | ✅ 100%  |\n| Develop middleware support                                                | ✅ 100%  |\n| Develop support for middleware compress                                   | ✅ 100%  |\n| Develop support for middleware cors                                       | ✅ 100%  |\n| Develop logger middleware support                                         | ✅ 100%  |\n| Develop support for maxbody middlewares                                   | ✅ 100%  |\n| Develop middleware support msgid                                          | ✅ 100%  |\n| Develop middleware support msguuid                                        | ✅ 100%  |\n| Develop support Cors                                                      | ✅ 100%  |\n| Develop Cient Get                                                         | ✅ 100%  |\n| Develop Cient Post support                                                | ✅ 100%  |\n| Develop Cient Put support                                                 | ✅ 100%  |\n| Develop Cient support Delete                                              | ✅ 100%  |\n\n---\n\n## 🚧 Roadmap in Progress  \n\n| Task                                                     | Progress |\n| -------------------------------------------------------- | -------- |\n| Develop and relate to Listen the Config                  | ⏳ 42%   |\n| Develops support for Uploads and Uploads Multiples       | ✅ 100%  |\n| Develops support for JWT                                 | ⏳ 10%   |\n| Develop method to Facilitate ResponseWriter handling     | ⏳ 80%   |\n| Develop method to Facilitate the handling of the Request | ⏳ 80%   |\n| Develop Standard of Unit Testing                         | ⏳ 90%   |\n\n---\n\n## 🚀 Roadmap for Development  \n\n\n| Task                                                                                             | Progress |\n|--------------------------------------------------------------------------------------------------|----------|\n| 📚 Documentation: Tests \u0026 Examples for Go Packages                                               | ⏳ 80%   |\n| ✅ Static Files support                                                                          | ✅ 100%  |\n| ✅ Support for HTTP `OPTIONS` method                                                             | ✅ 100%  |\n| ⚙️ Test coverage via `go test -cover`                                                            | ⏳ 86.1% |\n| 🔍 Regex feature coverage, dynamic routing possibilities                                         | ⏳ 80%   |\n| 📦 Template engine system (layouts, embed.FS, AddFunc)                                           | ✅ 100%  |\n| 🧪 Standard for unit testing + helper functions                                                  | ⏳ 90%   |\n| 🔐 Rate Limiter middleware                                                                       | ✅ 100%  |\n| 🧰 Middleware: Recover (panic handler)                                                           | ✅ 100%  |\n| ❤️ Middleware: Healthcheck                                                                      | ✅ 100%  |\n| 🛡️ Middleware: Helmet (security headers)                                                        | ✅ 100%  |\n| 📏 Middleware: MaxBody (request size limiter)                                                    | ✅ 100%  |\n| 📜 Middleware: Logger (request logging)                                                          | ✅ 100%  |\n| 🔐 Middleware: BasicAuth                                                                         | ✅ 100%  |\n| 🌐 Middleware: CORS                                                                              | ✅ 100%  |\n| 🧠 Middleware: PPROF                       \t\t\t\t\t\t\t\t\t\t\t\t\t\t  | ✅ 100%  |\n| 🔌 Develop support for HTTP `CONNECT` method [RFC 9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-connect) | 🟡 45%   |\n| 🔒 JWT Authentication support                                                                    | ✅ 100%   |\n| 🌐 WebSocket support                                                                             | 🔴 0%    |\n| 🔒 `ListenAndServeTLS` method (HTTP/2)                                                           | 🟡 50%   |\n| 🛠 Create a CLI (Command Line Interface) for Quick                                               | 🟡 50%   |\n\n---\n\n\n\n\n## 📊 Cover Testing Roadmap  \n\n| Archive     | Coverage | Status |\n| ----------- | -------- | ------ |\n| Ctx         | 🟡 84.1% | 🟡     |\n| Group       | ✅ 100.0% | 🟢     |\n| Http Status | 🔴 7.8%  | 🔴     |\n| Client      | 🟢 91.5% | 🟢     |\n| Mock        | ✅ 100.0% | 🟢     |\n| Concat      | ✅ 100.0% | 🟢     |\n| Log         | 🔴 0.0%  | 🔴     |\n| Print       | 🟡 66.7% | 🟡     |\n| Qos         | 🔴 0.0%  | 🔴     |\n| Rand        | 🔴 0.0%  | 🔴     |\n| Compress   | ✅ 100.0%   | 🟢     |\n| Cors        | 🟡 79.2% | 🟡     |\n| Logger      |  🟢 89.6% | 🟢     |\n| Maxbody     | ✅ 100.0% | 🟢     |\n| Msgid       |  🟢 80.0% | 🟢     |\n| Msguuid     | 🟢 86.4% | 🟢     |\n| Quick       |  🟢 85.3% |  🟢     |\n| QuickTest   | ✅ 100.0% | 🟢     |\n| Recover     | ✅ 100.0%   | 🟢     |\n| Pprof     | ✅ 100.0%   | 🟢     |\n| Healthcheck | 🟢 83.3%   | 🟢     |\n| Helmet      | 🟢 81.2%   | 🟢     |\n| BasicAuth   |  🟡 78.9%   |  🟡     |\n| Template    | 🟡 53.3%   | 🟡     |\n| Limiter    | 🟡 71.4%   | 🟡     |\n\n### Fast quick example\n\nWhen using New, you can configure global parameters such as request body limits, read/write time-out and route capacity. Below is a custom configuration:\n\n```go\nvar ConfigDefault = Config{\n\tBodyLimit:         4 * 1024 * 1024,\n\tMaxBodySize:       4 * 1024 * 1024,\n\tMaxHeaderBytes:    2 * 1024 * 1024,\n\tRouteCapacity:     500,\n\tMoreRequests:      500,\n\tReadTimeout:       5 * time.Second,\n\tWriteTimeout:      5 * time.Second,\n\tIdleTimeout:       2 * time.Second,\n\tReadHeaderTimeout: 1 * time.Second,\n}\n```\n\nCheck out the code below:\n\n```go\npackage main\n\nimport \"github.com/jeffotoni/quick\"\nfunc main() {\n\t// Initialize a new Quick instance\n    q := quick.New()\n\n\t// Define a simple GET route at the root path\n    q.Get(\"/v1/user\", func(c *quick.Ctx) error {\n        c.Set(\"Content-Type\", \"application/json\")\n        return c.Status(200).SendString(\"Quick in action ❤️!\")\n    })\n\n\t/// Start the server on port 8080\n    q.Listen(\"0.0.0.0:8080\")\n}\n\n```\n### 📌 cURL\n```bash\n$ curl -i -XGET -H \"Content-Type:application/json\" \\\n'localhost:8080/v1/user'\n\n\"Quick in action ❤️!\"\n```\n\n### Quick Get Params\nThe example below defines a GET/v1/customer/:param1/:param2 endpoint, where :param1 and :param2 are variables on the route that can receive dynamic values.\n\n```go\npackage main\n\nimport \"github.com/jeffotoni/quick\"\n\nfunc main() {\n    // Initialize a new Quick instance\n    q := quick.New()\n\n    // Define a GET route with two dynamic parameters (:param1 and :param2)\n    q.Get(\"/v1/customer/:param1/:param2\", func(c *quick.Ctx) error {\n        // Set response content type to JSON\n        c.Set(\"Content-Type\", \"application/json\")\n\n        // Define a struct for the response format\n        type my struct {\n            Msg string `json:\"msg\"` \n            Key string `json:\"key\"` \n            Val string `json:\"val\"` \n        }\n\n        // Return a JSON response with extracted parameters\n        return c.Status(200).JSON(\u0026my{\n            Msg: \"Quick ❤️\",\n            Key: c.Param(\"param1\"), \n            Val: c.Param(\"param2\"), \n        })\n    })\n\n\t// Start the server on port 8080\n    q.Listen(\"0.0.0.0:8080\")\n}\n\n```\n### 📌 cURL\n```bash\n$ curl -i -XGET -H \"Content-Type:application/json\" \\\n'localhost:8080/v1/customer/val1/val2'\n\n{\n   \"msg\":\"Quick ❤️\",\n   \"key\":\"val1\",\n   \"val\":\"val2\"\n}\n```\n\n### Quick Post Body json\nThis example shows how to create a POST endpoint to receive and process a JSON request body. The code reads the data sent in the request body and converts it to a Go structure.\n\n```go\npackage main\n\nimport \"github.com/jeffotoni/quick\"\n\n// Define a struct to map the expected JSON body\ntype My struct {\n    Name string `json:\"name\"`\n    Year int    `json:\"year\"`\n}\n\nfunc main() {\n    // Initialize a new Quick instance\n    q := quick.New()\n\n    // Define a POST route to handle JSON request body\n    q.Post(\"/v1/user\", func(c *quick.Ctx) error {\n        var my My\n\n\t\t// Parse the request body into the 'my' struct\n        err := c.BodyParser(\u0026my)\n        if err != nil {\n            return c.Status(400).SendString(err.Error())\n        }\n\n        // Return the received JSON data\n        return c.Status(200).String(c.BodyString())\n        // Alternative:\n        // return c.Status(200).JSON(\u0026my)\n    })\n\n\t// Start the server on port 8080\n    q.Listen(\"0.0.0.0:8080\")\n}\n```\n### 📌 cURL\n\n```bash\n$ curl -i -XPOST -H \"Content-Type:application/json\" \\\n'localhost:8080/v1/user' \\\n-d '{\"name\":\"jeffotoni\", \"year\":1990}'\n\n{\n   \"name\":\"jeffotoni\",\n   \"year\":1990\n}\n```\n\n## Uploads multipart/form-data\n\nQuick provides a simplified API for managing uploads, allowing you to easily retrieve and manipulate files.\n\n### ✅ **Main Methods and Functionalities**:\n| Method | Description |\n|--------|-----------|\n| `c.FormFile(\"file\")` | Returns a single file uploaded in the form. |\n| `c.FormFiles(\"files\")` | Returns a list of uploaded files (multiple uploads). |\n| `c.FormFileLimit(\"10MB\")` | Sets an upload limit (default is `1MB`). |\n| `uploadedFile.FileName()` | Returns the file name. |\n| `uploadedFile.Size()` | Returns the file size in bytes. |\n| `uploadedFile.ContentType()` | Returns the MIME type of the file. |\n| `uploadedFile.Bytes()` | Returns the bytes of the file. |\n| `uploadedFile.Save(\"/path/\")` | Saves the file to a specified directory. |\n| `uploadedFile.Save(\"/path\", \"your-name-file\")` | Saves the file with your name. |\n| `uploadedFile.SaveAll(\"/path\")` | Saves the file to a specified directory. |\n\n---\n\n### 📌 File Upload Feature Comparison with other Frameworks\n\n| Framework | `FormFile()` | `FormFiles()` | Dynamic Limit | Methods (`FileName()`, `Size()`)   | `Save()`, `SaveAll()` Method |\n| --------- | ------------ | ------------- | ------------- | ---------------------------------- | ---------------------------- |\n| **Quick** | ✅ Yes       | ✅ Yes        | ✅ Yes        | ✅ Yes                             | ✅ Yes                       |\n| Fiber     | ✅ Yes       | ✅ Yes        | ❌ No         | ❌ No (uses `FileHeader` directly) | ✅ Yes                       |\n| Gin       | ✅ Yes       | ✅ Yes        | ❌ No         | ❌ No (uses `FileHeader` directly) | ❌ No                        |\n| Echo      | ✅ Yes       | ❌ No         | ❌ No         | ❌ No                              | ❌ No                        |\n| net/http  | ✅ Yes       | ❌ No         | ❌ No         | ❌ No                              | ❌ No                        |\n\n---\n### File Upload Example\nThis example shows how to create a file upload endpoint. It allows users to send a single file via POST to the/upload route.\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/jeffotoni/quick\"\n)\n\n// Define a struct for error messages\ntype Msg struct {\n\tMsg   string `json:\"msg\"`\n\tError string `json:\"error\"`\n}\n\nfunc main() {\n    // Initialize a new Quick instance\n    q := quick.New()\n\n\t// Define a route for file upload\n    q.Post(\"/upload\", func(c *quick.Ctx) error {\n        // set limit upload\n        c.FormFileLimit(\"10MB\")\n\n\t\t// Retrieve the uploaded file\n        uploadedFile, err := c.FormFile(\"file\")\n        if err != nil {\n            return c.Status(400).JSON(Msg{\n                Msg: \"Upload error\",\n                Error: err.Error(),\n             })\n        }\n\n\t\t// Print file details\n        fmt.Println(\"Name:\", uploadedFile.FileName())\n        fmt.Println(\"Size:\", uploadedFile.Size())\n        fmt.Println(\"MIME Type:\", uploadedFile.ContentType())\n\n        // Save the file (optional)\n        // uploadedFile.Save(\"/tmp/uploads\")\n\n\t\t// Return JSON response with file details\n\t\t// Alternative:\n        //return c.Status(200).JSONIN(uploadedFile)\n\t\treturn c.Status(200).JSON(map[string]interface{}{\n\t\t\t\"name\": uploadedFile.FileName(),\n\t\t\t\"size\": uploadedFile.Size(),\n\t\t\t\"type\": uploadedFile.ContentType(),\n\t\t})\n\t\t\n    })\n\n\t// Start the server on port 8080\n    q.Listen(\"0.0.0.0:8080\")\n}\n```\n### 📌 cURL\n\n```bash\n$ curl -i -X POST http://localhost:8080/upload -F \"file=quick.txt\"\n\n{\n   \"name\":\"quick.txt\",\n   \"size\":1109,\n   \"type\":\"text/plain; charset=utf-8\"\n}\n```\n\n### Multiple Upload Example\nThis example allows users to send multiple files via POST to the/upload-multiple route\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/jeffotoni/quick\"\n)\n\n// Define a struct for error messages\ntype Msg struct {\n\tMsg   string `json:\"msg\"`\n\tError string `json:\"error\"`\n}\n\nfunc main() {\n\t// Initialize a new Quick instance\n\tq := quick.New()\n\n\tq.Post(\"/upload-multiple\", func(c *quick.Ctx) error {\n\t\t// set limit upload\n\t\tc.FormFileLimit(\"10MB\")\n\n\t\t// recebereceiving files\n\t\tfiles, err := c.FormFiles(\"files\")\n\t\tif err != nil {\n\t\t\treturn c.Status(400).JSON(Msg{\n\t\t\t\tMsg:   \"Upload error\",\n\t\t\t\tError: err.Error(),\n\t\t\t})\n\t\t}\n\n\t\t// listing all files\n\t\tfor _, file := range files {\n\t\t\tfmt.Println(\"Name:\", file.FileName())\n\t\t\tfmt.Println(\"Size:\", file.Size())\n\t\t\tfmt.Println(\"Type MINE:\", file.ContentType())\n\t\t\tfmt.Println(\"Bytes:\", file.Bytes())\n\t\t}\n\n\t\t// optional\n\t\t// files.SaveAll(\"/my-dir/uploads\")\n\n\t\t// Alternative:\n\t\t//return c.Status(200).JSONIN(files)\n\t\treturn c.Status(200).JSON(\"Upload successfully completed\")\n\t})\n\n\t// Start the server on port 8080\n\tq.Listen(\"0.0.0.0:8080\")\n}\n```\n\n### 📌 cURL\n\n```bash\n$ curl -X POST http://localhost:8080/upload-multiple \\\n-F \"files=@image1.jpg\" -F \"files=@document.pdf\"\n\nUpload successfully completed\n```\n\n### Quick Post Bind json\n\n```go\npackage main\n\nimport \"github.com/jeffotoni/quick\"\n\n// Define a struct to map the expected JSON body\ntype My struct {\n    Name string `json:\"name\"`\n    Year int    `json:\"year\"`\n}\n\nfunc main() {\n\t// Initialize a new Quick instance\n    q := quick.New()\n\n   // Define a POST route to handle JSON request body\n\tq.Post(\"/v2/user\", func(c *quick.Ctx) error {\n\t\tvar my My\n\n\t\t// Parse the request body into the 'my' struct\n\t\terr := c.Bind(\u0026my)\n\t\tif err != nil {\n\t\t\t// Return a 400 status if JSON parsing fails\n\t\t\treturn c.Status(400).SendString(err.Error())\n\t\t}\n\n\t\t// Return the received JSON data\n\t\treturn c.Status(200).JSON(\u0026my)\n\t})\n\n\t// Start the server on port 8080\n    q.Listen(\"0.0.0.0:8080\")\n}\n```\n\n### 📌 cURL\n\n```bash\n$ curl -i -XPOST -H \"Content-Type:application/json\" \\\n'localhost:8080/v2/user' \\\n-d '{\"name\":\"Marcos\", \"year\":1990}'\n\n{\n   \"name\":\"Marcos\",\n   \"year\":1990\n}\n\n```\n### Cors\n\nUsing the Cors middleware, making your call in the default way, which is:\n\n```go\nvar ConfigDefault = Config{\n AllowedOrigins: []string{\"*\"},\n AllowedMethods: []string{\"GET\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\"},\n AllowedHeaders: []string{\"Origin\", \"Content-Type\", \"Accept\", \"Authorization\"},\n ExposedHeaders: []string{\"Content-Length\"},\n AllowCredentials: false,\n MaxAge: 600,\n Debug: false,\n}\n```\n\nCheck out the code below:\n\n```go\npackage main\n\nimport (\n    \"github.com/jeffotoni/quick\"\n    \"github.com/jeffotoni/quick/middleware/cors\"\n)\n\nfunc main() {\n\n   // Initialize a new Quick instance\n    q := quick.New()\n\n    // Use the CORS middleware to allow cross-origin requests\n    q.Use(cors.New())\n\n    // Define a GET route at /v1/user\n    q.Get(\"/v1/user\", func(c *quick.Ctx) error {\n        // Set the response content type to JSON\n        c.Set(\"Content-Type\", \"application/json\")\n\n        // Return a response with status 200 and a message\n        return c.Status(200).SendString(\"Quick in action com Cors❤️!\")\n    })\n\n\t// Start the server on port 8080\n    q.Listen(\"0.0.0.0:8080\")\n}\n\n```\n### 📌 cURL\n\n```bash\n$ curl -i -XGET -H \"Content-Type:application/json\" \\\n'http://localhost:8080/v1/user'\n\nQuick in action com Cors❤️!\n```\n\n\n### Initializing Quick with Custom Configuration\nThis example demonstrates how to start a Quick server with a custom configuration.\n```go\npackage main\n\nimport \"github.com/jeffotoni/quick\"\n\nfunc main() {\n    // Create a new Quick server instance with custom configuration\n    q := quick.New(quick.Config{\n        MaxBodySize: 5 * 1024 * 1024, // Set max request body size to 5MB\n    })\n\n    // Define a GET route that returns a JSON response\n    q.Get(\"/v1/user\", func(c *quick.Ctx) error {\n        c.Set(\"Content-Type\", \"application/json\") // Set response content type\n        return c.Status(200).SendString(\"Quick in action com Cors❤️!\") // Return response\n    })\n\n\t// Start the server on port 8080\n    q.Listen(\"0.0.0.0:8080\")\n}\n```\n### 📌 cURL\n\n```bash\n$ curl -i -XGET -H \"Content-Type:application/json\" \\\n'http://localhost:8080/v1/user'\n\nQuick in action com Cors❤️!\n```\n\n### Grouping Routes\nThis example demonstrates how to group routes using quick. Group(), making the code more organized\n```go\npackage main\n\nimport \"github.com/jeffotoni/quick\"\n\nfunc main() {\n     // Create a new Quick server instance with custom configuration\n    q := quick.New(quick.Config{\n        MaxBodySize: 5 * 1024 * 1024, \n    })\n\n    // Group for /v1 routes\n    v1 := q.Group(\"/v1\")\n\n    // Define GET and POST routes for /v1/user\n    v1.Get(\"/user\", func(c *quick.Ctx) error {\n        return c.Status(200).SendString(\"[GET] [GROUP] /v1/user ok!!!\")\n    })\n    v1.Post(\"/user\", func(c *quick.Ctx) error {\n        return c.Status(200).SendString(\"[POST] [GROUP] /v1/user ok!!!\")\n    })\n\n \t // Group for /v2 routes\n    v2 := q.Group(\"/v2\")\n\n    // Define GET and POST routes for /v2/user\n    v2.Get(\"/user\", func(c *quick.Ctx) error {\n        c.Set(\"Content-Type\", \"application/json\")\n        return c.Status(200).SendString(\"Quick in action com [GET] /v2/user ❤️!\")\n    })\n\n    v2.Post(\"/user\", func(c *quick.Ctx) error {\n        c.Set(\"Content-Type\", \"application/json\")\n        return c.Status(200).SendString(\"Quick in action com [POST] /v2/user ❤️!\")\n    })\n\n\t// Start the server on port 8080\n    q.Listen(\"0.0.0.0:8080\")\n}\n\n```\n### 📌 cURL\n1️⃣ GET /v1/user\n```bash\n$ curl -i -X GET http://localhost:8080/v1/user\n\n[GET] [GROUP] /v1/user ok!!!\n```\n2️⃣ POST /v1/user\n```bash\n$ curl -i -X POST http://localhost:8080/v1/user\n\n[POST] [GROUP] /v1/user ok!!!\n```\n3️⃣ GET /v2/user\n```bash\n$ curl -i -X GET http://localhost:8080/v2/user\n\nQuick in action com [GET] /v2/user ❤️!\n```\n4️⃣ POST /v2/user\n```bash\n$ curl -i -X POST http://localhost:8080/v2/user\n\nQuick in action com [POST] /v2/user ❤️!\n```\n\n### Quick Tests\nThis example demonstrates how to unit test routes in Quick using QuickTest().\nIt simulates HTTP requests and verifies if the response matches the expected output\n\n```go\npackage main\n\nimport (\n    \"io\"\n    \"strings\"\n    \"testing\"\n\n    \"github.com/jeffotoni/quick\"\n)\n\nfunc TestQuickExample(t *testing.T) {\n\n    // Here is a handler function Mock\n    testSuccessMockHandler := func(c *quick.Ctx) error {\n        c.Set(\"Content-Type\", \"application/json\")\n        b, _ := io.ReadAll(c.Request.Body)\n        resp := `\"data\":` + string(b)\n        return c.Byte([]byte(resp))\n    }\n\n    // Initialize Quick instance for testing\n    q := quick.New()\n\n    // Define test routes\n    q.Post(\"/v1/user\", testSuccessMockHandler)\n    q.Post(\"/v1/user/:p1\", testSuccessMockHandler)\n\n    // Expected response data\n    wantOutData := `\"data\":{\"name\":\"jeff\", \"age\":35}`\n    reqBody := []byte(`{\"name\":\"jeff\", \"age\":35}`)\n    reqHeaders := map[string]string{\"Content-Type\": \"application/json\"}\n\n    // Perform test request\n\tdata, err := q.Qtest(QuickTestOptions{\n\tMethod:  MethodPost,\n\tURI:     \"/v1/user\",\n\tHeaders: map[string]string{\"Content-Type\": \"application/json\"},\n\t})\n\tif err != nil {\n\t\tt.Errorf(\"Error during Qtest: %v\", err)\n\t\treturn\n\t}\n\n    // Compare expected and actual response\n    s := strings.TrimSpace(data.BodyStr())\n    if s != wantOutData {\n        t.Errorf(\"Expected %s but got %s\", wantOutData, s)\n        return\n    }\n\n    // Log test results\n    t.Logf(\"\\nOutputBodyString -\u003e %v\", data.BodyStr())\n    t.Logf(\"\\nStatusCode -\u003e %d\", data.StatusCode())\n    t.Logf(\"\\nOutputBody -\u003e %v\", string(data.Body()))\n    t.Logf(\"\\nResponse -\u003e %v\", data.Response())\n}\n\n```\n\n---\n\n###  Regex\n\nThis example allows access only when the ID is numeric ([0-9]+).\n\n```go\npackage main\n\nimport (\n\t\"github.com/jeffotoni/quick\"\n)\n\nfunc main() {\n\t// Initialize a new Quick instance\n\tq := quick.New()\n\n\t// Route that accepts only numeric IDs (using regex [0-9]+)\n\tq.Get(\"/users/{id:[0-9]+}\", func(c *quick.Ctx) error {\n\t\tid := c.Param(\"id\")\n\t\treturn c.JSON(map[string]string{\n\t\t\t\"message\": \"User found\",\n\t\t\t\"user_id\": id,\n\t\t})\n\t})\n\n\t// Start the server on port 8080\n\tq.Listen(\":8080\")\n}\n```\n### 📌 cURL\n```bash\n$ curl -i -X GET http://localhost:8080/users/123\n\n{\n   \"message\":\"User found\",\n   \"user_id\":\"123\"\n}\n```\n\n### Accepts only lowercase letters in the slug\nThis example ensures that only lowercase letters ([a-z]+) are accepted in the slug\n\n```go\npackage main\n\nimport (\n\t\"github.com/jeffotoni/quick\"\n)\n\nfunc main() {\n\t// Initialize a new Quick instance\n\tq := quick.New()\n\n\t// Route that accepts only lowercase slugs (words with lowercase letters)\n\t\tq.Get(\"/profile/{slug:[a-z]+}\", func(c *quick.Ctx) error {\n\t\tslug := c.Param(\"slug\")\n\t\treturn c.JSON(map[string]string{\n\t\t\t\"message\": \"Profile found\",\n\t\t\t\"profile\": slug,\n\t\t})\n\t})\n\n\t// Start the server on port 8080\n\tq.Listen(\":8080\")\n}\n```\n### 📌 cURL\n```bash\n$ curl -i -X GET http://localhost:8080/profile/johndoe\n\n{\n   \"message\":\"Profile found\",\n   \"profile\":\"johndoe\"\n}\n```\n\n### Supports API version and numeric Id\n\n```go\npackage main\n\nimport (\n\t\"github.com/jeffotoni/quick\"\n)\n\nfunc main() {\n\t// Initialize a new Quick instance\n\tq := quick.New()\n\n\t// Route that accepts an API version (v1, v2, etc.) and a numeric user ID\n\tq.Get(\"/api/{version:v[0-9]+}/users/{id:[0-9]+}\", func(c *quick.Ctx) error {\n\t\tversion := c.Param(\"version\")\n\t\tid := c.Param(\"id\")\n\t\treturn c.JSON(map[string]string{\n\t\t\t\"message\": \"API Versioned User\",\n\t\t\t\"version\": version,\n\t\t\t\"user_id\": id,\n\t\t})\n\t})\n\n\t// Start the server on port 8080\n\tq.Listen(\":8080\")\n}\n```\n### 📌 cURL\n```bash\n$ curl -i -X GET http://localhost:8080/api/v1/users/123\n\n{\n   \"message\":\"API Versioned User\",\n   \"user_id\":\"123\",\n   \"version\":\"v1\"\n}\n```\n\n## 🔑 Basic Authentication\n\n**Basic Authentication (Basic Auth)** is a simple authentication mechanism defined in **RFC 7617**.  \nIt is commonly used for **HTTP-based authentication**, allowing clients to provide **credentials (username and password)** in the request header.\n\n\n### 🔹 **How It Works**\n1️⃣ The **client encodes** the username and password in Base64: \n\n2️⃣ The **encoded credentials** are sent in the `Authorization` header:  \n```bash\nAuthorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=\n```\n3️⃣ The server decodes and verifies the credentials before granting access.\n\n---\n\n### **⚠️ Security Considerations**\n- 🔒 Not encrypted – Basic Auth only encodes credentials in Base64, but does not encrypt them.\n- 🔐 Use over HTTPS – Always use Basic Auth with TLS/SSL (HTTPS) to prevent credentials from being exposed.\n- 🔑 Consider alternatives – For stronger security, prefer OAuth2, JWT, or API keys.\nBasic Auth is suitable for simple use cases, but for production applications, stronger authentication mechanisms are recommended. 🚀\n\n#### Basic Auth environment variables\n\nThis example sets up Basic Authentication using environment variables to store the credentials securely.\nthe routes below are affected, to isolate the route use group to apply only to routes in the group.\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/jeffotoni/quick\"\n\tmiddleware \"github.com/jeffotoni/quick/middleware/basicauth\"\n)\n\n// Environment variables for authentication\n// export USER=admin\n// export PASSWORD=1234\n\nvar (\n\t// Retrieve the username and password from environment variables\n\tUser     = os.Getenv(\"USER\")\n\tPassword = os.Getenv(\"PASSORD\")\n)\n\nfunc main() {\n\n\t// Initialize a new Quick instance\n\tq := quick.New()\n\n\t// Apply Basic Authentication middleware\n\tq.Use(middleware.BasicAuth(User, Password))\n\n\t// Define a protected route\n\tq.Get(\"/protected\", func(c *quick.Ctx) error {\n\t\t// Set the response content type to JSON\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\n\t\t// Return a success message\n\t\treturn c.SendString(\"You have accessed a protected route!\")\n\t})\n\n\t// Start the server on port 8080\n\tq.Listen(\"0.0.0.0:8080\")\n}\n```\n### 📌 cURL\n```bash\n$ curl -i -X GET http://localhost:8080/api/v1/users/123\n\nYou have accessed a protected route!\n```\n---\n\n### Basic Authentication with Quick Middleware\n\nThis example uses the built-in BasicAuth middleware provided by Quick, offering a simple authentication setup.\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick\"\n\tmiddleware \"github.com/jeffotoni/quick/middleware/basicauth\"\n)\n\nfunc main() {\n\n\t//starting Quick\n\tq := quick.New()\n\n\t// calling middleware\n\tq.Use(middleware.BasicAuth(\"admin\", \"1234\"))\n\n\t// everything below Use will apply the middleware\n\tq.Get(\"/protected\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\t\treturn c.SendString(\"You have accessed a protected route!\")\n\t})\n\n\t// Start the server on port 8080\n\tq.Listen(\"0.0.0.0:8080\")\n}\n\n```\n### 📌 cURL\n```bash\n$ curl -i -X GET 'http://localhost:8080/protected' \\\n--header 'Authorization: Basic YWRtaW46MTIzNA=='\n\nYou have accessed a protected route!\n```\n\n### Basic Authentication with Quick Route Groups\n\nThis example shows how to apply Basic Authentication to a specific group of routes using Quick's Group functionality.\nWhen we use group we can isolate the middleware, this works for any middleware in quick.\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick\"\n\tmiddleware \"github.com/jeffotoni/quick/middleware/basicauth\"\n)\n\nfunc main() {\n\t//starting Quick\n\tq := quick.New()\n\n\t// using group to isolate routes and middlewares\n\tgr := q.Group(\"/\")\n\n\t// middleware BasicAuth\n\tgr.Use(middleware.BasicAuth(\"admin\", \"1234\"))\n\n\t// route public\n\tq.Get(\"/v1/user\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\t\treturn c.SendString(\"Public quick route\")\n\t})\n\n\t// protected route\n\tgr.Get(\"/protected\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\t\treturn c.SendString(\"You have accessed a protected route!\")\n\t})\n\n\t// Start the server on port 8080\n\tq.Listen(\"0.0.0.0:8080\")\n}\n\n```\n### 📌 cURL\n```bash\n$ curl -i -X GET http://localhost:8080/v1/user\n\nPublic quick route\n```\n\n\n### BasicAuth Customized\n\nThis example shows a custom implementation of Basic Authentication without using any middleware. It manually verifies user credentials and applies authentication to protected routes.\n\nIn quick you are allowed to make your own custom implementation directly in q.Use(..), that is, you will be able to implement it directly if you wish.\n\n```go\npackage main\n\nimport (\n\t\"encoding/base64\"\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\n\t\"github.com/jeffotoni/quick\"\n)\n\nfunc main() {\n\t//starting Quick\n\tq := quick.New()\n\n\t// implementing middleware directly in Use\n\tq.Use(func(next http.Handler) http.Handler {\n\t\t// credentials\n\t\tusername := \"admin\"\n\t\tpassword := \"1234\"\n\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tauthHeader := r.Header.Get(\"Authorization\")\n\t\t\tif authHeader == \"\" {\n\t\t\t\thttp.Error(w, \"Unauthorized\", http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Check if it starts with \"Basic\"\n\t\t\tif !strings.HasPrefix(authHeader, \"Basic \") {\n\t\t\t\thttp.Error(w, \"Unauthorized\", http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Decode credentials\n\t\t\tpayload, err := base64.StdEncoding.DecodeString(authHeader[len(\"Basic \"):])\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(w, \"Unauthorized\", http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcreds := strings.SplitN(string(payload), \":\", 2)\n\t\t\tif len(creds) != 2 || creds[0] != username || creds[1] != password {\n\t\t\t\thttp.Error(w, \"Unauthorized\", http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tnext.ServeHTTP(w, r)\n\t\t})\n\t})\n\n\tq.Get(\"/protected\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\t\treturn c.SendString(\"You have accessed a protected route!\")\n\t})\n\n\t// Start the server on port 8080\n\tq.Listen(\"0.0.0.0:8080\")\n\n}\n```\n### 📌 cURL\n```bash\n$ curl -i -u admin:1234 -X GET http://localhost:8080/protected\n\nYou have accessed a protected route!\n```\n\n---\n\n## 📂 **STATIC FILES**\n\nA **Static File Server** is an essential feature in web frameworks, enabling the efficient serving of static content such as **HTML, CSS, JavaScript, images, and other assets**.  \n\nIt is particularly useful for:  \n- ✅ Hosting front-end applications  \n- ✅ Providing downloadable files  \n- ✅ Serving resources directly from the backend  \n\n---\n\n### 🔹 **How It Works**\n- 1️⃣ The server **listens** for HTTP requests targeting static file paths.  \n- 2️⃣ If the requested file **exists** in the configured directory, the server reads and returns it as a response.  \n- 3️⃣ **MIME types** are automatically determined based on the file extension for correct rendering.  \n\n---\n\n### ⚡ **Key Features**\n- 🚀 **Efficient Handling** – Serves files directly without additional processing.  \n- 🎯 **MIME Type Detection** – Automatically identifies file types for proper rendering.  \n- ⚡ **Caching Support** – Can be configured to improve performance via HTTP headers.  \n- 📂 **Optional Directory Listing** – Allows browsing available static files (if enabled).  \n\n---\n\n### ⚠️ **Security Considerations**\n- 🔒 **Restrict Access** – Prevent exposure of sensitive files like `.env`, `.git`, or configuration files.  \n- 🌐 **CORS Policies** – Configure **Cross-Origin Resource Sharing (CORS)** to control file access.  \n- 🛡 **Content Security Policy (CSP)** – Helps mitigate **XSS (Cross-Site Scripting)** risks.  \n\n---\n\nBy properly configuring your static file server, you can ensure **fast, efficient, and secure delivery of resources**! 🚀🔥\n\n---\n\n### Serving Static Files with Quick Framework\n\nThis example sets up a basic web server that serves static files, such as HTML, CSS, or JavaScript.\n\n```go\npackage main\n\nimport \"github.com/jeffotoni/quick\"\n\nfunc main() {\n\n    //starting Quick\n    q := quick.New()\n\n    // Static Files Setup\n    q.Static(\"/static\", \"./static\")\n\n    // Route Definition\n    q.Get(\"/\", func(c *quick.Ctx) error {\n        c.File(\"./static/index.html\")\n        return nil\n    })\n\n    // Start the server on port 8080\n    q.Listen(\"0.0.0.0:8080\")\n}\n```\n### 📌 cURL\n```bash\n$ curl -i -X GET http://localhost:8080/\n\nFile Server Go example html\n```\n---\n\n### 📁 EMBED - Embedded Static Files\n\n### 🔹 How do embedded static files work?\n1. Static assets (HTML, CSS, JS, images, etc.) are **compiled directly into the binary** at compile time, using the Go package `embed`.\n2. The application **serves these files from memory**, eliminating the need to access the disk.\n3. This **removes external dependencies**, making the deployment simpler and more efficient.\n\n---\n### ⚡ Advantages of using embedded files:\n- ✅ **Portability** - The binary contains everything you need, no extra files.  \n- ✅ **Performance** - File access is faster because files are already loaded in memory.  \n- ✅ **Security** - Reduces exposure to attacks because the file system does not need to be accessible.  \n\n---\n### 🚀 How does Quick simplify this process?\nThe function `q. Static()` already handles the complexity of serving embedded files. Just call it with `embed.FS`.\n\nThe example shows how to serve static files with Quick and `embed.FS`\n\n```go\npackage main\n\nimport (\n\t\"embed\"\n\n\t\"github.com/jeffotoni/quick\"\n)\n\n//go:embed static\nvar staticFiles embed.FS\n\nfunc main() {\n\t// Server Initialization\n\tq := quick.New()\n\n\t// Static Files Setup (serves files automatically from embed.FS)\n\tq.Static(\"/static\", staticFiles)\n\n\t// Defines a route that serves the HTML index file\n\tq.Get(\"/\", func(c *quick.Ctx) error {\n\t\tc.File(\"./static/index.html\") \t\n\t\treturn nil\n\t})\n\n\t// Start the server on port 8080\n\tq.Listen(\"0.0.0.0:8080\")\n}\n\n```\n### 📌 cURL\n```bash\n$ curl -i -X GET http://localhost:8080/\n\nFile Server Go example html\n```\n\n### 📂 Example Project Structure\n```text\nquick-example\n│── main.go\n│── static/\n│   ├── index.html\n│   ├── style.css\n│   ├── script.js\n```\n\n---\n\n## 🌍 HTTP Client\n\nThe **HTTP Client** package in **Quick** provides a **simple and flexible** way to make HTTP requests, supporting **GET, POST, PUT, and DELETE** operations. 🚀\n\nIt is designed to handle different types of request bodies and parse responses easily.\n\n###  🎯 Why Use Quick's HTTP Client?\n- ✅ Easy-to-Use – Simplified functions for common HTTP requests.\n- ✅ Highly Customizable – Supports headers, authentication, and transport settings.\n- ✅ Flexible Body Parsing – Works with JSON, plain text, and custom io.Reader types.\n- ✅ Automatic JSON Handling – No need to manually marshal/unmarshal JSON.\n\n\n### ⚡ Key Features\n\n- 🔹 **Convenience Functions** – Use `Get`, `Post`, `Put`, and `Delete` to make quick requests with a default client.\n- 🔹 **Customizable Requests** – Easily add headers, authentication, and request settings.\n- 🔹 **Automatic JSON Processing** – Seamless encoding and decoding of JSON data.\n- 🔹 **Flexible Request Body** – Send data as **JSON**, **plain text**, or any `io.Reader`.\n\n---\n### 📌 **Client Structure**\nThe `Client` struct represents a configurable HTTP client with advanced features:\n\n```go\nvar ClientDefault = Client{\n\tCtx:          context.Background(),\n\tClientHTTP:   httpGoClient{},\n\tHeaders:      map[string]string{\"Content-Type\": \"application/json\"},\n\tEnableLogger: true,\n\tLogger:       slog.Default(),\n}\n```\nCheck out the code below:\n\n### GET Request Example\nA GET request is used to retrieve data from a server.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick/http/client\"\n)\n\nfunc main() {\n\t// Create a new HTTP client\n\thttpClient := client.New()\n\n\t// Making a GET request to fetch a list of users\n\tresp, err := httpClient.Get(\"https://reqres.in/api/users\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Alternative:\n\t//fmt.Println(\"GET response:\", string(resp.Body))\n\n\t// Parse JSON response\n\tvar result map[string]interface{}\n\tif err := json.Unmarshal(resp.Body, \u0026result); err != nil {\n\t\tlog.Fatal(\"Error decoding response:\", err)\n\t}\n\n\t// Extract first user\n\tusers := result[\"data\"].([]interface{})\n\tfirstUser := users[0].(map[string]interface{})\n\n\t// Print only first user\n\tfmt.Printf(\"Id: %v\\n\", firstUser[\"id\"])\n\tfmt.Printf(\"Name: %v %v\\n\", firstUser[\"first_name\"], firstUser[\"last_name\"])\n\tfmt.Printf(\"Email: %v\\n\", firstUser[\"email\"])\n\tfmt.Printf(\"Avatar: %v\\n\", firstUser[\"avatar\"])\n}\n```\n### 📌 Response\n```bash\nId: 1\nName: George Bluth\nEmail: george.bluth@reqres.in\nAvatar: https://reqres.in/img/faces/1-image.jpg\n```\n\n### POST Request Example (Using a Struct)\nA POST request is used to send data to a server, often for creating new resources.\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick/http/client\"\n)\n\nfunc main() {\n\t// Create a new HTTP client\n\thttpClient := client.New()\n\n\t// Define a struct for the request body\n\tdata := struct {\n\t\tName string `json:\"name\"`\n\t}{\n\t\tName: \"Emma\",\n\t}\n\n\t// Making a POST request with JSON data\n\tresp, err := httpClient.Post(\"https://reqres.in/api/users\", data)\n\tif err != nil {\n\t\tlog.Fatal(\"Error making POST request:\", err)\n\t}\n\n\t// Parse JSON response\n\tvar result map[string]interface{}\n\tif err := json.Unmarshal(resp.Body, \u0026result); err != nil {\n\t\tlog.Fatal(\"Error decoding response:\", err)\n\t}\n\n\t// Alternative:\n\t//fmt.Println(\"POST response:\", result)\n\n\t// Print formatted response\n\tfmt.Println(\"Id:\", result[\"id\"])\n\tfmt.Println(\"Created_At:\", result[\"createdAt\"])\n}\n```\n### 📌 Response\n```bash\nId: 322\nCreated_At: 2025-03-14T14:48:24.305Z\n```\n\n### PUT Request Example (Using a String)\nA PUT request is used to update an existing resource.\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick/http/client\"\n)\n\nfunc main() {\n\t// Create a new HTTP client\n\thttpClient := client.New()\n\n\t// Define a struct with updated user data\n\tdata := struct {\n\t\tName string `json:\"name\"`\n\t}{\n\t\tName: \"Jeff\",\n\t}\n\n\t// PUT request to ReqRes API\n\tresp, err := httpClient.Put(\"https://reqres.in/api/users/2\", data)\n\tif err != nil {\n\t\tlog.Fatal(\"Error making PUT request:\", err)\n\t}\n\n\t// Parse JSON response\n\tvar result map[string]interface{}\n\tif err := json.Unmarshal(resp.Body, \u0026result); err != nil {\n\t\tlog.Fatal(\"Error decoding response:\", err)\n\t}\n\n\t// Alternative: Print the HTTP status and response body\n\t// fmt.Println(\"HTTP Status Code:\", resp.StatusCode)\n\t// fmt.Println(\"Raw Response Body:\", string(resp.Body))\n\n\t// Print formatted response\n\tfmt.Println(\"Updated_At:\", result[\"updatedAt\"])\n}\n```\n### 📌 Response\n```bash\nUpdated_At: 2025-03-14T14:56:35.202Z\n```\n\n### DELETE Request Example\nA DELETE request is used to remove a resource from the server.\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick/http/client\"\n)\n\nfunc main() {\n\n\t// Create a new HTTP client\n\thttpClient := client.New()\n\n\t// DELETE request to ReqRes API\n\tresp, err := httpClient.Delete(\"https://reqres.in/api/users/2\")\n\tif err != nil {\n\t\tlog.Fatal(\"Error making request:\", err)\n\t}\n\n\t// Print the HTTP status to confirm deletion\n\tfmt.Println(\"Status Code:\", resp.StatusCode)\n\n\t// Since DELETE usually returns no content, we check if it's empty\n\tif len(resp.Body) \u003e 0 {\n\t\tfmt.Println(\"Raw Response Body:\", string(resp.Body))\n\t} else {\n\t\tfmt.Println(\"Response Body is empty (expected for 204 No Content)\")\n\t}\n}\n```\n### 📌 Response\n```bash\nStatus Code: 204\nResponse Body is empty (expected for 204 No Content)\n```\n---\n\n## 🚀 Qtest - HTTP Testing Utility for Quick\n\nQtest is an **advanced HTTP testing function** designed to simplify route validation within the **Quick** framework. It enables seamless testing of simulated HTTP requests using `httptest`, supporting:\n\n- **Custom HTTP methods** (`GET`, `POST`, `PUT`, `DELETE`, etc.).\n- ✅ **Custom headers**.\n- ✅ **Query parameters**.\n- ✅ **Request body**.\n- ✅ **Cookies**.\n- ✅ **Built-in validation methods** for status codes, headers, and response bodies.\n\n## 📌 Overview\n\nThe `Qtest` function takes a `QuickTestOptions` struct containing request parameters, executes the request, and returns a `QtestReturn` object, which provides methods for analyzing and validating the result.\n\n```go\nfunc TestQTest_Options_POST(t *testing.T) {\n    // start Quick\n    q := New()\n\n    // Define the POST route\n    q.Post(\"/v1/user/api\", func(c *Ctx) error {\n        c.Set(\"Content-Type\", \"application/json\") // Simplified header setting\n        return c.Status(StatusOK).String(`{\"message\":\"Success\"}`)\n    })\n\n    // Configure test parameters\n    opts := QuickTestOptions{\n        Method: \"POST\",\n        URI:    \"/v1/user/api\",\n        QueryParams: map[string]string{\n            \"param1\": \"value1\",\n            \"param2\": \"value2\",\n        },\n        Body: []byte(`{\"key\":\"value\"}`),\n        Headers: map[string]string{\n            \"Content-Type\": \"application/json\",\n        },\n        Cookies: []*http.Cookie{\n            {Name: \"session\", Value: \"abc123\"},\n        },\n        LogDetails: true, // Enables detailed logging\n    }\n\n    // Execute test\n    result, err := q.Qtest(opts)\n    if err != nil {\n        t.Fatalf(\"Error in Qtest: %v\", err)\n    }\n\n    // Validations\n    if err := result.AssertStatus(StatusOK); err != nil {\n        t.Errorf(\"Status assertion failed: %v\", err)\n    }\n\n    if err := result.AssertHeader(\"Content-Type\", \"application/json\"); err != nil {\n        t.Errorf(\"Header assertion failed: %v\", err)\n    }\n\n    if err := result.AssertBodyContains(\"Success\"); err != nil {\n        t.Errorf(\"Body assertion failed: %v\", err)\n    }\n}\n```\n### 📌 Usage Reference\n\n| Function                        | Description                          |\n|---------------------------------|--------------------------------------|\n| `Qtest(opts QuickTestOptions)`  | Executes an HTTP test request       |\n| `AssertStatus(expected int)`    | Asserts expected HTTP status code   |\n| `AssertHeader(key, value string)` | Checks response header value        |\n| `AssertBodyContains(substr string)` | Verifies if body contains a string |\n\n\n### 📖 More Details\n🔗 **Check out the full documentation:** [Qtest - Quick](https://github.com/jeffotoni/quick/tree/main/quickTest)\n\n---\n\n## 🔄 Retry \u0026 Failover Mechanisms in Quick HTTP Client\n\nThe **Quick HTTP Client** now includes **built-in retry and failover support**, allowing for more resilient and reliable HTTP requests. These features are essential for handling **transient failures**, **network instability**, and **service downtime** efficiently.\n\n### 🚀 Key Features\n\n- 🔄 **Automatic Retries**: Retries failed requests based on configurable rules.\n- ⏳ **Exponential Backoff**: Gradually increases the delay between retry attempts.\n- 📡 **Status-Based Retries**: Retries only on specified HTTP status codes (e.g., `500`, `502`, `503`).\n- 🌍 **Failover Mechanism**: Switches to predefined backup URLs if the primary request fails.\n- 📑 **Logging Support**: Enables detailed logs for debugging retry behavior.\n\n---\n\n### 🔹 How Retry \u0026 Failover Work\n\nThe **retry mechanism** automatically **resends requests** when they fail, with configurable options to:\n\n- **Limit the number of retries** to avoid excessive attempts.\n- **Introduce backoff delays** to prevent overwhelming the server.\n- **Retry only on specific HTTP status codes** (e.g., `500`, `502`, `503`).\n\nThe **failover system** ensures **high availability** by redirecting failed requests to **predefined backup URLs**, reducing downtime and improving system resilience.\n\n### ⚙️ Configuration Options\nThese options allow fine-grained control over retry and failover behavior:\n\n| Option          | Description 🚀 |\n|----------------|----------------------------------------------------------------|\n| **MaxRetries**  | Sets the **maximum number of retry attempts** before failure. |\n| **Delay**       | Defines the **initial delay** before retrying a request. |\n| **UseBackoff**  | Enables **exponential backoff**, increasing delay dynamically after each retry. |\n| **Statuses**    | List of **HTTP status codes** (e.g., `500`, `502`, `503`) that trigger a retry. |\n| **FailoverURLs** | List of **backup URLs** used if the primary request repeatedly fails. |\n| **EnableLog**   | Enables **detailed logging** for debugging retry behavior. |\n\n---\n\n### ⚙️ **Configuring Retries \u0026 Failover in Quick HTTP Client**\n\n\nThe **Quick HTTP Client** provides built-in support for **retrying failed requests** and **switching to failover URLs** when necessary.  \n\nYou can configure these behaviors using the **`WithRetry`** option, which accepts a `RetryConfig` struct.\n\n### **🛠 Creating a Custom Client with Retries**\nThe following example shows how to create a Quick client with **retry and failover mechanisms**.\n\n```go\n// Creating a Quick client using a custom HTTP client and retry settings.\ncClient := client.New(\n    client.WithCustomHTTPClient(customHTTPClient), \n    client.WithContext(context.Background()),      \n \tclient.WithHeaders(map[string]string{\n\t\t\t\"Content-Type\": \"application/json\", \n\t\t}),\n    client.WithRetry(client.RetryConfig{\n        MaxRetries:   3,                      \n        Delay:        2 * time.Second,        \n        UseBackoff:   true,                \n        Statuses:     []int{500, 502, 503, 504}, \n        FailoverURLs: []string{\"http://hosterror\", \"https://httpbin.org/post\"},\n        EnableLog:    true,                  \n    }),\n)\n```\n### 🔄 Smart Retries: Exponential Backoff \u0026 Failover to Backup URLs\nThis example demonstrates retrying a request with an increasing delay (backoff) when encountering errors.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/jeffotoni/quick/http/client\"\n)\n\nfunc main() {\n\t// Create a new Quick HTTP client with retry settings\n\tcClient := client.New(\n\t\tclient.WithRetry(\n\t\t\tclient.RetryConfig{\n\t\t\t\tMaxRetries: 3,       \n\t\t\t\tDelay:      1 * time.Second,  \n\t\t\t\tUseBackoff: true,   \n\t\t\t\tStatuses:   []int{500, 502, 503}, \n\t\t\t\tFailoverURLs: []string{\"http://backup1.com/resource\", \"https://httpbin_error.org/get\", \"https://httpbin.org/get\"},\n\t\t\t\tEnableLog:  true,   \n\t\t\t}),\n\t)\n\n\t// Send a GET request to the specified URL\n\tresp, err := cClient.Get(\"https://httpbin_error.org/get\")\n\tif err != nil {\n\t\tlog.Fatal(\"GET request failed:\", err)\n\t}\n\n\t// Print the response body\n\tfmt.Println(\"GET Response:\", string(resp.Body))\n}\n```\n### 📌 Response\n```bash\n{\"time\":\"2025-03-14T14:27:02.069237664-03:00\",\"level\":\"WARN\",\"msg\":\"Retrying request\",\"url\":\"https://httpbin_error.org/get\",\"method\":\"GET\",\"attempt\":1,\"failover\":1}\n{\"time\":\"2025-03-14T14:27:13.076907091-03:00\",\"level\":\"WARN\",\"msg\":\"Retrying request\",\"url\":\"http://backup1.com/resource\",\"method\":\"GET\",\"attempt\":2,\"failover\":2}\n{\"time\":\"2025-03-14T14:27:15.258544931-03:00\",\"level\":\"WARN\",\"msg\":\"Retrying request\",\"url\":\"https://httpbin_error.org/get\",\"method\":\"GET\",\"attempt\":3,\"failover\":3}\nGET Response: {\n  \"args\": {}, \n  \"headers\": {\n    \"Accept-Encoding\": \"gzip\", \n    \"Host\": \"httpbin_error.org\", \n    \"User-Agent\": \"Go-http-client/1.1\", \n    \"X-Amzn-Trace-Id\": \"Root=1-67d466f8-1aafed0512167ac32426bc9f\"\n  }, \n  \"origin\": \"179.216.110.129\", \n  \"url\": \"https://httpbin_error.org/get\"\n}\n```\n\n### 🔥 How Each Feature Works in the Code  \n\n### 🔄 **Retry with Exponential Backoff**  \n- The retry mechanism is triggered because `MaxRetries: 3` allows the request to be retried up to **three times**.  \n- The wait time between attempts **automatically increases** due to `UseBackoff: true`.  \n- A retry **only occurs** if the response contains an HTTP error listed in `Statuses: []int{500, 502, 503}`.  \n\n### 🌍 **Failover to Backup URLs**  \n- If **all retry attempts on the primary URL fail**, the client will try the **alternative URLs** listed in `FailoverURLs`.  \n- In this example, if `https://httpbin.org/status/500` keeps failing, it will switch to `https://httpbin.org/get`.  \n\n\n\n---\n\n## 📝 Form Submission with `PostForm` in Quick HTTP Client  \n\nThe **Quick HTTP Client** now supports **`PostForm`**, making it easier to send **form-encoded data (`application/x-www-form-urlencoded`)**.  \nThis feature is particularly useful for:  \n\n✅ **Authentication requests**  \n✅ **Submitting data to web services**  \n✅ **Integrations with legacy systems that do not accept JSON**  \n\n---\n\n## 🔹 Why Use `PostForm`?  \n\n| 🚀 **Feature**              | 💡 **Benefit** |\n|-----------------------------|------------------------------------------------|\n| **📑 Optimized for Forms**    | Makes it easy to send form-encoded data (`application/x-www-form-urlencoded`). |\n| **⚙️ Automatic Encoding**    | Converts `url.Values` into a valid form submission format. |\n| **📌 Header Management**     | Automatically sets `Content-Type: application/x-www-form-urlencoded`. |\n| **🔄 Consistent API**        | Follows the same design as `Post`, `Get`, `Put`, ensuring ease of use. |\n| **🌍 Better Compatibility**  | Works seamlessly with APIs that do not accept JSON payloads. |\n\n\n---\n\n### 🔹 How PostForm Works\n\nThe PostForm method encodes form parameters, adds necessary headers, and sends an HTTP POST request to the specified URL. It is specifically designed for APIs and web services that do not accept JSON payloads but require form-encoded data.\n\n### 🔹 **Quick Server with Form Submission**\n\nThe following example demonstrates how to send form-encoded data using Quick PostForm:\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/url\"\n\t\"time\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/http/client\"\n)\n\nfunc main() {\n\t// Initialize Quick framework\n\tq := quick.New()\n\n\t// Define a POST route to handle form data submission\n\tq.Post(\"/postform\", func(c *quick.Ctx) error {\n\t\t// Retrieve form values from the request\n\t\tform := c.FormValues()\n\n\t\t// Return the received form data as JSON response\n\t\treturn c.JSON(map[string]any{\n\t\t\t\"message\": \"Received form data\",\n\t\t\t\"data\":    form,\n\t\t})\n\t})\n\n\t// Start the Quick server in a separate goroutine\n\tgo func() {\n\t\tfmt.Println(\"Quick server running at http://localhost:3000\")\n\t\tif err := q.Listen(\":3000\"); err != nil {\n\t\t\tlog.Fatalf(\"Failed to start Quick server: %v\", err)\n\t\t}\n\t}()\n\n\ttime.Sleep(2 * time.Second)\n\n\t// Create an HTTP client before calling PostForm\n\tcClient := client.New(\n\t\tclient.WithTimeout(5*time.Second),\n\t\tclient.WithHeaders(map[string]string{\n\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\",\n\t\t}),\n\t)\n\n\t// Declare form data (key-value pairs)\n\tformData := url.Values{}\n\tformData.Set(\"username\", \"quick_user\")\n\tformData.Set(\"password\", \"supersecret\")\n\n\t// Send a POST request with form data\n\tresp, err := cClient.PostForm(\"http://localhost:3000/postform\", formData)\n\tif err != nil {\n\t\tlog.Fatalf(\"PostForm request failed: %v\", err)\n\t}\n\n\t// Unmarshal the JSON response from the server\n\tvar result map[string]any\n\tif err := json.Unmarshal(resp.Body, \u0026result); err != nil {\n\t\tlog.Fatal(\"Failed to parse JSON response:\", err)\n\t}\n\n\t// Print the formatted JSON response\n\t// Alternative:fmt.Println(\"POST Response:\", result)\n\n\t// Print the formatted JSON response\n\tformattedResponse, err := json.MarshalIndent(result, \"\", \"  \")\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to format JSON response:\", err)\n\t}\n\n\tfmt.Println(\"POST Response:\")\n\tfmt.Println(string(formattedResponse))\n\n}\n```\n### 📌 Response\n```bash\nPOST Response:\n{\n  \"data\": {\n    \"password\": [\n      \"supersecret\"\n    ],\n    \"username\": [\n      \"quick_user\"\n    ]\n  },\n  \"message\": \"Received form data\"\n}\n```\n---\n\n## 🌐 Transport Configuration in HTTP Client\n\nThe `Transport` setting in the Quick HTTP Client **manages the network layer**, ensuring efficient, secure, and reliable HTTP communications.\nIt provides **fine-grained** control over **connection management, security settings, and protocol optimizations** for both **development and production environments**.\n\n### ✅ Key Features of Transport Configuration  \n\n| ⚙️ **Setting**              | 🔍 **Description**  |\n|-----------------------------|----------------------------------------------------------------------------------------------------------------|\n| **🛠 Proxy Settings**       | Handles **proxy servers** using system environment settings for automatic configuration.  |\n| **🔒 TLS Configuration**    | Controls **security settings**, such as **TLS version** and **certificate verification**. `InsecureSkipVerify` can be enabled for development to bypass SSL verification.  |\n| **📡 Connection Management** | Optimizes resource usage with settings like `MaxIdleConns`, `MaxConnsPerHost`, and `MaxIdleConnsPerHost`, improving **scalability**.  |\n| **🚀 Persistent Connections** | Enables or disables **Keep-Alives**, reducing connection setup time and improving performance. |\n| **⚡ HTTP/2 Support**        | Enables **HTTP/2** for faster, more efficient communication when supported by the server. |\n \n\n#### Advanced HTTP client configuration with failover mechanism\n\nThis code example showcases the setup of an HTTP client capable of handling network interruptions and server failures gracefully. It features custom transport configurations, including enhanced security settings, connection management, and a robust failover mechanism. Such a setup ensures that the application remains resilient and responsive under various network conditions.\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"crypto/tls\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/jeffotoni/quick/http/client\"\n)\n\nfunc main() {\n\n\tcustomTransport := \u0026http.Transport{\n\t\t// Uses system proxy settings if available.\n\t\tProxy: http.ProxyFromEnvironment,\n\t\tTLSClientConfig: \u0026tls.Config{\n\t\t\t// Allows insecure TLS connections .\n\t\t\tInsecureSkipVerify: true,\n\t\t\t// Enforces a minimum TLS version for security.\n\t\t\tMinVersion:         tls.VersionTLS12,\n\t\t},\n\t\t // Maximum number of idle connections across all hosts.\n\t\tMaxIdleConns:        50,\n\t\t// Maximum simultaneous connections per host.\n\t\tMaxConnsPerHost:     30,\n\t\t// Maximum number of idle connections per host.\n\t\tMaxIdleConnsPerHost: 10,\n\t\t// Enables persistent connections (Keep-Alive).\n\t\tDisableKeepAlives:   false,\n\t}\n\n\t// Creating a fully custom *http.Client with the transport and timeout settings.\n\tcustomHTTPClient := \u0026http.Client{\n\t\t// Sets a global timeout for all requests.\n\t\tTimeout: 5 * time.Second,\n\t}\n\n\t// Creating a client using both the custom transport and other configurations.\n\tcClient := client.New(\n\t\t// Applying the custom HTTP client.\n\t\tclient.WithCustomHTTPClient(customHTTPClient),\n\t\t// Custom context for request cancellation and deadlines.\n\t\tclient.WithContext(context.Background()),\n\t\tclient.WithHeaders(map[string]string{\n\t\t\t\"Content-Type\":  \"application/json\",\n\t\t\t\"Authorization\": \"Bearer YOUR_ACCESS_TOKEN\",\n\t\t}),\n\t\t// Applying the custom transport.\n\t\tclient.WithTransport(customTransport),\n\t\t// Setting a timeout for requests.\n\t\tclient.WithTimeout(5*time.Second),\n\t\t// Retry on specific status codes.\n\t\tclient.WithRetry(\n\t\t\tclient.RetryConfig{\n\t\t\t\tMaxRetries:   2,\n\t\t\t\tDelay:        1 * time.Second,\n\t\t\t\tUseBackoff:   true,\n\t\t\t\tStatuses:     []int{500},\n\t\t\t\tFailoverURLs: []string{\"http://hosterror\", \"https://httpbin.org/post\"},\n\t\t\t\tEnableLog:    true,\n\t\t\t}),\n\t)\n\n\t// call client to POST\n\tresp, err := cClient.Post(\"https://httpbin_error.org/post\", map[string]string{\"message\": \"Quick in action\"})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// show resp\n\tfmt.Println(\"POST response:\\n\", string(resp.Body))\n}\n```\n### 📌 Response\n```bash\n{\"time\":\"2025-03-14T15:31:11.027180616-03:00\",\"level\":\"WARN\",\"msg\":\"Retrying request\",\"url\":\"https://httpbin_error.org/post\",\"method\":\"POST\",\"attempt\":1,\"failover\":1}\n{\"time\":\"2025-03-14T15:31:12.028294877-03:00\",\"level\":\"WARN\",\"msg\":\"Retrying request\",\"url\":\"http://hosterror\",\"method\":\"POST\",\"attempt\":2,\"failover\":2}\nPOST response:\n {\n  \"args\": {}, \n  \"data\": \"{\\\"message\\\":\\\"Quick in action\\\"}\", \n  \"files\": {}, \n  \"form\": {}, \n  \"headers\": {\n    \"Accept-Encoding\": \"gzip\", \n    \"Authorization\": \"Bearer YOUR_ACCESS_TOKEN\", \n    \"Content-Length\": \"29\", \n    \"Content-Type\": \"application/json\", \n    \"Host\": \"httpbin_error.org\", \n    \"User-Agent\": \"Go-http-client/1.1\", \n    \"X-Amzn-Trace-Id\": \"Root=1-67d475f2-713b9e4c2fff65d413fcd097\"\n  }, \n  \"json\": {\n    \"message\": \"Quick in action\"\n  }, \n  \"origin\": \"179.216.110.129\", \n  \"url\": \"https://httpbin_error.org/post\"\n}\n```\n---\n\n#### HTTP Client with Advanced Transport and Failover Capabilities\n\nExplore how to set up an HTTP client that not only adheres to security best practices with TLS configurations but also ensures your application remains operational through network issues. This example includes detailed setups for handling HTTP client retries and switching to failover URLs when typical requests fail. Ideal for systems requiring high reliability and fault tolerance.\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"crypto/tls\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/jeffotoni/quick/http/client\"\n)\n\nfunc main() {\n\n\t// Creating a custom HTTP transport with advanced settings.\n\tcustomTransport := \u0026http.Transport{\n\t\t// Uses system proxy settings if available.\n\t\tProxy: http.ProxyFromEnvironment,\n\t\tTLSClientConfig: \u0026tls.Config{\n\t\t\t // Allows insecure TLS connections (not recommended for production).\n\t\t\tInsecureSkipVerify: true,\n\t\t\t// Enforces a minimum TLS version for security.\n\t\t\tMinVersion:         tls.VersionTLS12,\n\t\t},\n\t\t// Maximum number of idle connections across all hosts.\n\t\tMaxIdleConns:        50,\n\t\t// Maximum simultaneous connections per host.\n\t\tMaxConnsPerHost:     30,\n\t\t // Maximum number of idle connections per host.\n\t\tMaxIdleConnsPerHost: 10,\n\t\t// Enables persistent connections (Keep-Alive).\n\t\tDisableKeepAlives:   false,\n\t}\n\n\t// Creating a fully custom *http.Client with the transport and timeout settings.\n\tcustomHTTPClient := \u0026http.Client{\n\t\t // Sets a global timeout for all requests.\n\t\tTimeout:   5 * time.Second,\n\t\t// Uses the custom transport.\n\t\tTransport: customTransport,\n\t}\n\n\t// Creating a client using both the custom transport and other configurations.\n\tcClient := client.New(\n\t\t// Applying the custom HTTP client.\n\t\tclient.WithCustomHTTPClient(customHTTPClient),\n\t\t // Custom context for request cancellation and deadlines.\n\t\tclient.WithContext(context.Background()),\n\t\tclient.WithHeaders(map[string]string{\n\t\t\t\"Content-Type\":  \"application/json\",\n\t\t\t\"Authorization\": \"Bearer YOUR_ACCESS_TOKEN\",\n\t\t}),\n\t\tclient.WithTimeout(5*time.Second), // Setting a timeout for requests.\n\t\t// Retry on specific status codes.\n\t\tclient.WithRetry(\n\t\t\tclient.RetryConfig{\n\t\t\t\tMaxRetries:   2,\n\t\t\t\tDelay:        1 * time.Second,\n\t\t\t\tUseBackoff:   true,\n\t\t\t\tStatuses:     []int{500},\n\t\t\t\tFailoverURLs: []string{\"http://hosterror\", \"https://httpbin.org/post\"},\n\t\t\t\tEnableLog:    true,\n\t\t\t}),\n\t)\n\n\tresp, err := cClient.Post(\"https://httpbin_error.org/post\", map[string]string{\"name\": \"jeffotoni\"})\n\tif err != nil {\n\t\tlog.Fatalf(\"POST request failed: %v\", err)\n\t}\n\n\t// show resp\n\tfmt.Println(\"POST response:\", string(resp.Body))\n}\n```\n### 📌 Response\n```bash\n{\"time\":\"2025-03-14T15:37:43.481220287-03:00\",\"level\":\"WARN\",\"msg\":\"Retrying request\",\"url\":\"https://httpbin_error.org/post\",\"method\":\"POST\",\"attempt\":1,\"failover\":1}\n{\"time\":\"2025-03-14T15:37:44.482388761-03:00\",\"level\":\"WARN\",\"msg\":\"Retrying request\",\"url\":\"http://hosterror\",\"method\":\"POST\",\"attempt\":2,\"failover\":2}\nPOST response: {\n  \"args\": {}, \n  \"data\": \"{\\\"name\\\":\\\"jeffotoni\\\"}\", \n  \"files\": {}, \n  \"form\": {}, \n  \"headers\": {\n    \"Accept-Encoding\": \"gzip\", \n    \"Authorization\": \"Bearer YOUR_ACCESS_TOKEN\", \n    \"Content-Length\": \"20\", \n    \"Content-Type\": \"application/json\", \n    \"Host\": \"httpbin_error.org\", \n    \"User-Agent\": \"Go-http-client/1.1\", \n    \"X-Amzn-Trace-Id\": \"Root=1-67d4777b-50d494284d3d242224dc62c0\"\n  }, \n  \"json\": {\n    \"name\": \"jeffotoni\"\n  }, \n  \"origin\": \"179.216.110.129\", \n  \"url\": \"https://httpbin_error.org/post\"\n}\n```\n\n---\n\n### Configuring HTTP Client with Retry and Failover Mechanisms\n\nDiscover how to build an HTTP client capable of dealing with network instabilities and server failures. This setup includes detailed retry configurations and introduces failover URLs to ensure that your application can maintain communication under adverse conditions. The example demonstrates using exponential backoff for retries and provides multiple endpoints to guarantee the availability of services.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/jeffotoni/quick/http/client\"\n)\n\nfunc main() {\n\t// Create a new HTTP client with specific configurations.\n\tcClient := client.New(\n\t\t// Set a timeout for all requests made by this client to 10 seconds.\n\t\t// This helps prevent the client from hanging indefinitely on requests.\n\t\tclient.WithTimeout(10*time.Second),\n\n\t\t// Set default headers for all requests made by this client.\n\t\t// Here, 'Content-Type' is set to 'application/json'\n\t\t//  which is typical for API calls.\n\t\tclient.WithHeaders(map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t}),\n\n\t\t// Enable automatic retry mechanism with specific configurations.\n\t\t// This is useful for handling intermittent errors and ensuring robustness.\n\t\tclient.WithRetry(\n\t\t\tclient.RetryConfig{\n\t\t\t\t // Retry failed requests up to two times.\n\t\t\t\tMaxRetries: 2,\n\t\t\t\t// Wait for 1 second before retrying.\n\t\t\t\tDelay:      1 * time.Second,\n\t\t\t\t // Use exponential backoff strategy for retries.\n\t\t\t\tUseBackoff: true,\n\t\t\t\t// HTTP status codes that trigger a retry.\n\t\t\t\tStatuses:   []int{500, 502, 503},\n\t\t\t\t// Alternate URLs to try if the main request fails.\n\t\t\t\tFailoverURLs: []string{\n\t\t\t\t\t\"http://hosterror\",\n\t\t\t\t\t\"https://httpbin.org/post\",\n\t\t\t\t},\n\t\t\t\t// Enable logging for retry operations.\n\t\t\t\tEnableLog: true,\n\t\t\t}),\n\t)\n\n\t// Perform a POST request using the configured HTTP client.\n\t// Includes a JSON payload with a \"name\" key.\n\tresp, err := cClient.Post(\"https://httpbin_error.org/post\", map[string]string{\n\t\t\"name\": \"jeffotoni in action with Quick!!!\",\n\t})\n\n\t// Check if there was an error with the POST request.\n\tif err != nil {\n\t\t// If an error occurs, log the error and terminate the program.\n\t\tlog.Fatalf(\"POST request failed: %v\", err)\n\t}\n\n\t// Print the response from the server to the console.\n\tfmt.Println(\"POST Form Response:\", string(resp.Body))\n}\n\n```\n### 📌 Response\n```bash\n{\"time\":\"2025-03-14T15:40:30.617507958-03:00\",\"level\":\"WARN\",\"msg\":\"Retrying request\",\"url\":\"https://httpbin_error.org/post\",\"method\":\"POST\",\"attempt\":1,\"failover\":1}\n{\"time\":\"2025-03-14T15:40:31.618144855-03:00\",\"level\":\"WARN\",\"msg\":\"Retrying request\",\"url\":\"http://hosterror\",\"method\":\"POST\",\"attempt\":2,\"failover\":2}\nPOST Form Response: {\n  \"args\": {}, \n  \"data\": \"{\\\"name\\\":\\\"jeffotoni in action with Quick!!!\\\"}\", \n  \"files\": {}, \n  \"form\": {}, \n  \"headers\": {\n    \"Accept-Encoding\": \"gzip\", \n    \"Content-Length\": \"44\", \n    \"Content-Type\": \"application/json\", \n    \"Host\": \"httpbin_error.org\", \n    \"User-Agent\": \"Go-http-client/1.1\", \n    \"X-Amzn-Trace-Id\": \"Root=1-67d47822-5c80648f5a30c75c6a500470\"\n  }, \n  \"json\": {\n    \"name\": \"jeffotoni in action with Quick!!!\"\n  }, \n  \"origin\": \"179.216.110.129\", \n  \"url\": \"https://httpbin_error.org/post\"\n}\n```\n\n---\n\n### Advanced HTTP Client Configuration with Transport and Retry Settings\n\nExplore the configuration of an HTTP client designed for high reliability and security in network communications. This example includes sophisticated transport settings, featuring TLS configurations for enhanced security, and a robust retry mechanism to handle request failures gracefully. These settings are essential for applications requiring reliable data exchange with external APIs, especially in environments where network stability might be a concern.\n\n```go\npackage main\n\nimport (\n\t\"crypto/tls\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/jeffotoni/quick/http/client\"\n)\n\nfunc main() {\n\t// Create an HTTP client with custom configurations using the Quick framework.\n\tcClient := client.New(\n\t\t// Set a global timeout for all requests made by this client to 10 seconds.\n\t\t// This helps prevent the client from hanging indefinitely on requests.\n\t\tclient.WithTimeout(10*time.Second),\n\n\t\t// Set default headers for all requests made by this client.\n\t\t// Here, we specify that we expect to send and receive JSON data.\n\t\tclient.WithHeaders(map[string]string{\"Content-Type\": \"application/json\"}),\n\n\t\t// Configure the underlying transport for the HTTP client.\n\t\tclient.WithTransportConfig(\u0026http.Transport{\n\t\t\t// Use the system environment settings for proxy configuration.\n\t\t\tProxy: http.ProxyFromEnvironment,\n\n\t\t\t// Configure TLS settings to skip verification of the server's\n\t\t\t// certificate chain and hostname.\n\t\t\t// Warning: Setting InsecureSkipVerify to true is not recommended for\n\t\t\t//  production as it is insecure.\n\t\t\tTLSClientConfig: \u0026tls.Config{InsecureSkipVerify: true},\n\n\t\t\t// Enable HTTP/2 for supported servers.\n\t\t\tForceAttemptHTTP2: true,\n\n\t\t\t// Set the maximum number of idle connections in the connection pool for all hosts.\n\t\t\tMaxIdleConns: 20,\n\n\t\t\t// Set the maximum number of idle connections in the connection pool per host.\n\t\t\tMaxIdleConnsPerHost: 10,\n\n\t\t\t// Set the maximum number of simultaneous connections per host.\n\t\t\tMaxConnsPerHost: 20,\n\n\t\t\t// Keep connections alive between requests. This can help improve performance.\n\t\t\tDisableKeepAlives: false,\n\t\t}),\n\t)\n\n\t// Perform a POST request with a JSON payload.\n\t// The payload includes a single field \"name\" with a value.\n\tresp, err := cClient.Post(\"https://httpbin.org/post\", map[string]string{\"name\": \"jeffotoni\"})\n\tif err != nil {\n\t\t// Log the error and stop the program if the POST request fails.\n\t\tlog.Fatalf(\"POST request failed: %v\", err)\n\t}\n\n\t// Output the response from the POST request.\n\tfmt.Println(\"POST Form Response:\", string(resp.Body))\n}\n\n```\n### 📌 Response\n```bash\nPOST Form Response: {\n  \"args\": {}, \n  \"data\": \"{\\\"name\\\":\\\"jeffotoni\\\"}\", \n  \"files\": {}, \n  \"form\": {}, \n  \"headers\": {\n    \"Accept-Encoding\": \"gzip\", \n    \"Content-Length\": \"20\", \n    \"Content-Type\": \"application/json\", \n    \"Host\": \"httpbin.org\", \n    \"User-Agent\": \"Go-http-client/2.0\", \n    \"X-Amzn-Trace-Id\": \"Root=1-67d4786f-61ddc079287866e673f4f584\"\n  }, \n  \"json\": {\n    \"name\": \"jeffotoni\"\n  }, \n  \"origin\": \"179.216.110.129\", \n  \"url\": \"https://httpbin.org/post\"\n}\n```\n\n---\n\n## 🔐 TLS (Transport Layer Security) in Quick HTTP Server\n\n`TLS (Transport Layer Security)` is a cryptographic protocol that provides **secure communication** over a network.\nIt is widely used to encrypt data transmitted between clients and servers, ensuring **confidentiality, integrity, and authentication**. \nTLS is the **successor to SSL (Secure Sockets Layer)** and is used in **HTTPS, email security, and many other applications**.\n\n---\n\n### 🚀 Key TLS Features\n\n| 🔹 **Feature**        | 🔍 **Description**  |\n|----------------------|--------------------------------------------------------------|\n| 🔐 **Encryption**     | Protects data from being intercepted during transmission. |\n| 🔑 **Authentication** | Ensures the server (and optionally the client) is legitimate. |\n| 🔄 **Data Integrity** | Prevents data from being modified or tampered with in transit. |\n| ⚡ **Performance**    | Modern TLS versions (1.2, 1.3) offer strong security with minimal overhead. |\n\n---\n\n### 🌍 Running a Secure HTTPS Server with Quick and TLS\nThis example demonstrates how to set up an HTTPS server using Quick with TLS encryption, ensuring secure communication between clients and the server.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/jeffotoni/quick\"\n)\n\nfunc main() {\n\t// Initialize Quick instance\n\tq := quick.New()\n\n\t// Print a message indicating that the server is starting on port 8443\n\tfmt.Println(\"Run Server port:8443\")\n\n\t// Start the HTTPS server with TLS encryption\n\t// - The server will listen on port 8443 (non-privileged port)\n\t// - cert.pem: SSL/TLS certificate file\n\t// - key.pem: Private key file for SSL/TLS encryption\n\terr := q.ListenTLS(\":8443\", \"cert.pem\", \"key.pem\", false)\n\tif err != nil {\n\t\t// Log an error message if the server fails to start\n\t\tfmt.Printf(\"Error when trying to connect with TLS: %v\\n\", err)\n\t}\n}\n\n```\n\n### ⚠️Ports \u0026 Permissions Considerations\n\nThis example **uses port 8443** so that it runs on **any operating system without requiring extra permissions**.\n\nHowever, in production, you may want to use the **standard HTTPS port 443**.\n\n- **Port 443** (default for HTTPS) is a **privileged port** (below 1024).\n- On **Linux**, running a service on port 443 requires **superuser privileges**.\n\nTo run on **port 443** on Linux, use:\n\n```bash\n$ sudo go run main.go\n```\n---\n\n## 🚦 Rate Limiter - Request Limiting Middleware\n\nThe **Rate Limiter** is a middleware for the Quick framework that controls the number of requests allowed in a given time period. It helps prevent API abuse and improves system stability by preventing server overload.\n\n### 🚀 Features\n\n| Feature                         | Description |\n|----------------------------------|-------------|\n| 🎯 **Request Rate Limiting**     | Configurable maximum number of requests per client within a time window. |\n| ⏳ **Automatic Expiration**      | Resets the request counter automatically after the configured time. |\n| 🔑 **Custom Client Identification** | Uses a `KeyGenerator` function to define a unique client key (e.g., IP-based). |\n| ⚠️ **Custom Response on Limit Exceeded** | Allows defining a custom response when the request limit is reached. |\n| ⚡ **Efficient Performance**     | Implements sharding and optimizations to reduce concurrency issues. |\n\n### 🌍 Global Rate Limiter \n\nThe example below shows how to apply the Rate Limiter as global middleware.\n```go\npackage main\n\nimport (\n\t\"time\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/limiter\"\n)\n\nfunc main() {\n\tq := quick.New()\n\n\t// Apply the rate limiter middleware\n\tq.Use(limiter.New(limiter.Config{\n\t\t// Maximum 10 requests allowed per IP\n\t\tMax: 10,\n\t\t// The limit resets after 5 seconds\n\t\tExpiration: 5 * time.Second,\n\t\tKeyGenerator: func(c *quick.Ctx) string {\n\t\t\t// Uses the client's IP address as the key\n\t\t\treturn c.RemoteIP()\n\t\t},\n\t\tLimitReached: func(c *quick.Ctx) error {\n\t\t\tc.Set(\"Content-Type\", \"application/json\")\n\t\t\t// The client should wait 10 seconds before retrying\n\t\t\tc.Set(\"Retry-After\", \"10\")\n\t\t\treturn c.Status(quick.StatusTooManyRequests).JSON(map[string]string{\n\t\t\t\t\"error\":   \"Too many requests\",\n\t\t\t\t\"message\": \"You have exceeded the request limit. \n\t\t\t\tPlease wait 1 second and try again.\",\n\t\t\t\t\"retry_after\": \"10s\",\n\t\t\t})\n\t\t},\n\t}))\n\n\t// Define a simple GET route\n\tq.Get(\"/\", func(c *quick.Ctx) error {\n\t\treturn c.Status(200).JSON(map[string]string{\"msg\": \"Quick in action ❤️!\"})\n\t})\n\n\t// Start the server on port 8080\n\tq.Listen(\":8080\")\n}\n\n\n```\n### 📌 cURL\n\n```bash\n$ curl -i -X GET http://localhost:8080/\n```\nIf the same IP makes more than 10 requests in 5 seconds, the middleware returns:\n\n```bash\n{\n    \"error\": \"Too many requests\",\n    \"message\": \"You have exceeded the request limit. \n\t Please wait 1 second and try again.\",\n    \"retry_after\": \"10s\"\n}\n```\n\n### 🌐 Using Rate Limiter for Specific Route Groups\n\nThe example below shows how to apply the Rate Limiter with route group.\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/limiter\"\n)\n\nfunc main() {\n\t// Create a new Quick instance\n\tq := quick.New()\n\n\t// Rate Limiter Middleware\n\tlimiterMiddleware := limiter.New(limiter.Config{\n\t\t// Maximum 3 requests allowed per IP address within a 10-second window\n\t\tMax: 3,\n\t\t// The limit resets every 10 seconds\n\t\tExpiration: 10 * time.Second,\n\t\t// Use the client's IP address as the unique key to track rate limits\n\t\tKeyGenerator: func(c *quick.Ctx) string {\n\t\t\treturn c.RemoteIP()\n\t\t},\n\t\t// If the rate limit is exceeded, send an error message and instructions\n\t\tLimitReached: func(c *quick.Ctx) error {\n\t\t\t// Set content type to JSON\n\t\t\tc.Set(\"Content-Type\", \"application/json\")\n\t\t\tc.Set(\"Retry-After\", \"10\") \n\t\t\t// Response structure\n\t\t\tresponse := map[string]string{\n\t\t\t\t\"error\":       \"Too many requests\",\n\t\t\t\t\"message\":     \"You have exceeded the request limit. \n\t\t\t\tPlease wait 10 seconds and try again.\",\n\t\t\t\t\"retry_after\": \"10s\",\n\t\t\t}\n\n\t\t\t// Log to verify that the rate limit exceeded response is being sent\n\t\t\tlog.Println(\"Rate Limit Exceeded:\", response)\n\n\t\t\t// Return the response with HTTP status 429 (Too Many Requests)\n\t\t\treturn c.Status(quick.StatusTooManyRequests).JSON(response)\n\t\t},\n\t})\n\n\t// Create an API group with rate limit middleware\n\tapi := q.Group(\"/v1\")\n\t// Apply the rate limiter middleware to the /api group\n\tapi.Use(limiterMiddleware)\n\n\t// Define route /api/users that responds with a list of users\n\tapi.Get(\"/users\", func(c *quick.Ctx) error {\n\t\treturn c.JSON(map[string]string{\"msg\": \"list of users\"})\n\t})\n\n\t// Define route /api/posts that responds with a list of posts\n\tapi.Get(\"/posts\", func(c *quick.Ctx) error {\n\t\treturn c.JSON(map[string]string{\"msg\": \"list of posts\"})\n\t})\n\n\t// Define route without rate limit\n\tq.Get(\"/\", func(c *quick.Ctx) error {\n\t\treturn c.JSON(map[string]string{\"msg\": \"Quick in action ❤️!\"})\n\t})\n\n\t// Start the server on port 8080\n\tq.Listen(\":8080\")\n}\n```\n### 📌 cURL\n\n```bash\n$ curl -i -X GET http://localhost:8080/users\n```\nIf an IP makes more than 3 requests within 10 seconds, the response is blocked and returns a 429 Too Many Requests error:\n\n```bash\n{\n    \"error\": \"Too many requests\",\n    \"message\": \"You have exceeded the request limit. \n\tPlease wait 10 seconds and try again.\",    \"retry_after\": \"10s\"\n}\n\n```\n---\n## 🚀 Benchmarks\n\n**Benchmarking** is a performance evaluation technique that measures response time, resource usage, and processing capacity. It helps developers identify bottlenecks and optimize their code. This approach is widely used in various areas, including software testing and hardware evaluations.\n\n\n### 📊 Why Benchmarking?\n\n| ✅ Benefit   | 🔍 Description |\n|--------------------------------------|-------------|\n| 📏 Measure performance   | Evaluates how a system responds under different workloads. |\n| 🔄 Compare technologies   | Allows you to analyze different frameworks, libraries or implementations. |\n| 🔍 Identify bottlenecks   | Helps detect critical points that need optimization. |\n| 📈 Ensure scalability   | Test system behavior with multiple simultaneous requests. |\n| 🎭 Simulate real-world scenarios   | Reproduces heavy use situations, such as thousands of users accessing a service at the same time. |\n\n\n### 🛠️ Load Testing with Quick and k6\n\nTo evaluate the performance of our API, we conducted a benchmark test using the [Quick](https://github.com/jeffotoni/quick) framework along with [k6](https://k6.io/) for load testing.\n\n\n### 🔹 API Code for Benchmarking\n\nThe following Go API was used for benchmarking. It provides a POST endpoint at /v1/user, which:\n\n- Accepts large JSON payloads.\n- Parses the incoming JSON into a Go struct.\n- Returns the parsed JSON as a response.\n\n```go\npackage main\n\nimport (\n\t\"github.com/jeffotoni/quick\"\n)\n\n// Struct representing a user model\ntype My struct {\n\tID       string                 `json:\"id\"`\n\tName     string                 `json:\"name\"`\n\tYear     int                    `json:\"year\"`\n\tPrice    float64                `json:\"price\"`\n\tBig      bool                   `json:\"big\"`\n\tCar      bool                   `json:\"car\"`\n\tTags     []string               `json:\"tags\"`\n\tMetadata map[string]interface{} `json:\"metadata\"`\n\tOptions  []Option               `json:\"options\"`\n\tExtra    interface{}            `json:\"extra\"`\n\tDynamic  map[string]interface{} `json:\"dynamic\"`\n}\n\ntype Option struct {\n\tKey   string `json:\"key\"`\n\tValue string `json:\"value\"`\n}\n\nfunc main() {\n\t// Initialize Quick framework with a 20MB body limit\n\tq := quick.New(quick.Config{\n\t\tMaxBodySize: 20 * 1024 * 1024,\n\t})\n\n\t// Define a POST route at /v1/user\n\tq.Post(\"/v1/user\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\t\tvar users []My // Store incoming user data\n\n\t\t// Parse the request body into the struct\n\t\terr := c.Bind(\u0026users)\n\t\tif err != nil {\n\t\t\t// If parsing fails, return a 400 Bad Request response\n\t\t\treturn c.Status(400).SendString(err.Error())\n\t\t}\n\n\t\t// Return the parsed JSON data as a response with 200 OK\n\t\treturn c.Status(200).JSON(users)\n\t})\n\n\t// Start the server and listen on port 8080\n\tq.Listen(\"0.0.0.0:8080\")\n}\n```\n### 🏆 k6 Load Test Script\n\n```javascript\nimport http from 'k6/http';\nimport { check, sleep } from 'k6';\n\n// Load the JSON from the environment variable\nconst payloadData = open('./data_1k_list.json');\n\n// K6 configuration\nexport let options = {\n    stages: [\n        { duration: '40s', target: 1000 }, // Ramp-up para 500 VUs\n        { duration: '7s', target: 500 },  // Mantém 500 VUs\n        { duration: '5s', target: 0 },   // Ramp-down\n    ],\n };\n\n\nexport default function () {\nlet url = 'http://localhost:8080/v1/user';\n\n// Always use the same list for sending\n// let payload = JSON.stringify(payloadData);\n\nlet params = {\nheaders: { 'Content-Type': 'application/json' },\n};\n\nlet res = http.post(url, payloadData, params);\n\n// Check if the response is correct\ncheck(res, {\n'status is 200 or 201': (r) =\u003e r.status === 200 || r.status === 201,\n'response contains JSON': (r) =\u003e r.headers['Content-Type'] === 'application/json',\n});\n\n}\n```\n\n### 📈 Running the Tests  \n\n- 1️⃣ Start the Quick API - Run the Quick server:  \n```bash\n$ go run main.go\n```\n- 2️⃣ Execute the Load Test\n```bash\n$ k6 run benchmark.js\n```\n---\n## 📦 Compression Middleware (compress)\nThe compress middleware in Quick enables automatic GZIP compression for HTTP responses, reducing the size of data transferred over the network. This improves performance and bandwidth efficiency, especially for text-based content like JSON, HTML, and CSS.\n\n### 🚀 Benefits of Compression\n- ✅ Reduced response size – improves loading speed.\n- ✅ Bandwidth savings – ideal for mobile or limited connections.\n- ✅ Seamless integration – works automatically for compatible clients.\n- ✅ Better user experience – faster response times.\n\n🔹 Ways to Use\nQuick provides three different ways to enable GZIP compression:\n\n### 🌟 Available Usage Methods\n\nQuick provides three different ways to enable GZIP compression:\n\n- Using quick.Handler (Default) – Follows Quick’s native syntax.\n- Using quick.HandlerFunc – Alternative method for direct function-based handlers.\n- Using net/http standard implementation – For applications using Go’s native HTTP package.\n\n#### For more details on using compress, check the documentation:\n\n\u003ch4 align=\"left\"\u003e \n\t\u003cp\u003e \n\t\t\u003ca href=\"middleware/README.md\"\u003e\n\t\t\t\u003cstrong\u003e📖 Compress Documentation\u003c/strong\u003e\n\t\t\u003c/a\u003e\n\t\u003c/p\u003e \n\u003c/h4\u003e\n\n### 🚀 Usage Example (Default)\nHere is a practical example of enabling the GZIP middleware in Quick using the default approach (quick.Handler)\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/compress\"\n)\n\nfunc main() {\n\tq := quick.New()\n\n\t// Enable Gzip middleware\n\tq.Use(compress.Gzip())\n\n\t// Define a route that returns a compressed JSON response\n\tq.Get(\"/v1/compress\", func(c *quick.Ctx) error {\n\t\t// Setting response headers\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\t\t// Enabling Gzip compression\n\t\tc.Set(\"Accept-Encoding\", \"gzip\") \n\t\t// Defining the response structure\n\t\ttype response struct {\n\t\t\tMsg     string              `json:\"msg\"`\n\t\t\tHeaders map[string][]string `json:\"headers\"`\n\t\t}\n\n\t\t// Returning a JSON response with headers\n\t\treturn c.Status(200).JSON(\u0026response{\n\t\t\tMsg:     \"Quick ❤️\",\n\t\t\tHeaders: c.Headers,\n\t\t})\n\t})\n\n\t// Start the HTTP server on port 8080\n\tlog.Fatal(q.Listen(\"0.0.0.0:8080\"))\n}\n```\n### 📌 cURL\n```bash\n$ curl -X GET http://localhost:8080/v1/compress -H \n\"Accept-Encoding: gzip\" --compressed -i\n```\n### 📌 Response\n```bash\n{\n   \"msg\":\"Quick ❤️\",\n   \"headers\":{\n      \"Accept\":[\n         \"*/*\"\n      ],\n      \"Accept-Encoding\":[\n         \"gzip\"\n      ],\n      \"Cache-Control\":[\n         \"no-cache\"\n      ],\n      \"Connection\":[\n         \"keep-alive\"\n      ],\n      \"Postman-Token\":[\n         \"e0b65cfe-9516-4803-96df-d443d7e6a95a\"\n      ],\n      \"User-Agent\":[\n         \"PostmanRuntime/7.43.2\"\n      ]\n   }\n}\n```\n---\n\n## 📏 Maxbody (Request Size Limiter)\n\nThe maxbody middleware restricts the maximum request body size to prevent clients from sending excessively large payloads. This helps optimize memory usage, enhance security, and avoid unnecessary processing of oversized requests.\n\n### 🔹 Why Use maxbody?\n- ✅ Prevents excessive memory usage and improves performance.\n- ✅ Mitigates DoS (Denial-of-Service) attacks by limiting large payloads.\n- ✅ Automatically returns 413 Payload Too Large when the limit is exceeded.\n\n---\n### 🚀 Ways to Use maxbody\nThere are two primary ways to enforce request body size limits in Quick:\n\n**maxbody.New()** – Enforces a global request body size limit across all middleware layers.\n\n**MaxBytesReader()** – Adds an extra layer of validation inside a specific request handler\n\n### 🔹 Using maxbody.New()\nThis example applies a global request body limit of 50KB for all incoming requests.\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/maxbody\"\n)\n\nfunc main() {\n\tq := quick.New()\n\n\t// Middleware to enforce a 50KB request body limit globally\n\tq.Use(maxbody.New(50 * 1024)) // 50KB\n\n\t// Define a route that accepts a request body\n\tq.Post(\"/v1/user/maxbody/any\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\n\t\tlog.Printf(\"Body received: %s\", c.BodyString())\n\t\treturn c.Status(200).Send(c.Body())\n\t})\n\n\tlog.Fatal(q.Listen(\"0.0.0.0:8080\"))\n}\n```\n### 📌 cURL\nRequest within limit (Valid request)\n\n```bash\n$ curl -X POST http://0.0.0.0:8080/v1/user/maxbody/any \\\n     -H \"Content-Type: application/json\" \\\n     --data-binary @\u003c(head -c 48000 \u003c/dev/zero | tr '\\0' 'A')\n```\nRequest exceeding limit (Should return 413)\n```bash\n$ curl -X POST http://0.0.0.0:8080/v1/user/maxbody/any \\\n     -H \"Content-Type: application/json\" \\\n     --data-binary @\u003c(head -c 51000 \u003c/dev/zero | tr '\\0' 'A')\n```\n---\n### 🔹 Using MaxBytesReader()\n\nThis example adds extra protection by applying MaxBytesReader() inside the request handler, ensuring an enforced limit at the application layer.\n\n```go\npackage main\n\nimport (\n\t\"io\"\n\t\"log\"\n\t\"net/http\"\n\n\t\"github.com/jeffotoni/quick\"\n)\n\nconst maxBodySize = 1024 // 1KB\n\nfunc main() {\n\tq := quick.New()\n\n\t// Define a route with additional MaxBytesReader validation\n\tq.Post(\"/v1/user/maxbody/max\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\n\t\t// Limit request body size to 1KB\n\t\tc.Request.Body = quick.MaxBytesReader(c.Response, c.Request.Body, maxBodySize)\n\n\t\t// Securely read the request body\n\t\tbody, err := io.ReadAll(c.Request.Body)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error reading request body: %v\", err)\n\t\t\treturn c.Status(http.StatusRequestEntityTooLarge).String(\"Request body too large\")\n\t\t}\n\t\treturn c.Status(http.StatusOK).Send(body)\n\t})\n\n\tlog.Println(\"Server running at http://0.0.0.0:8080\")\n\tlog.Fatal(q.Listen(\"0.0.0.0:8080\"))\n}\n```\n### 📌 cURL \n\nRequest within limit (Valid request)\n```bash\n$ curl -X POST http://0.0.0.0:8080/v1/user/maxbody/max \\\n     -H \"Content-Type: application/json\" \\\n     --data-binary @\u003c(head -c 800 \u003c/dev/zero | tr '\\0' 'A')\n```\n\nRequest exceeding limit (Should return 413)\n```bash\n$ curl -X POST http://0.0.0.0:8080/v1/user/maxbody/max \\\n     -H \"Content-Type: application/json\" \\\n     --data-binary @\u003c(head -c 2048 \u003c/dev/zero | tr '\\0' 'A')\n```\n\n---\n\n### 📌 Key Differences Between `maxbody.New()` and `MaxBytesReader()`\n\n| Implementation      | Description                                      |\n|--------------------|--------------------------------------------------|\n| `maxbody.New()`    | Enforces a **global** request body size limit **before processing** the request. |\n| `MaxBytesReader()` | Adds **extra validation inside the request handler**, restricting only specific endpoints. |\n\n---\n\n## 📜 Logger (Request Logging)\nThe `logger` middleware captures HTTP request details, helping with monitoring, debugging, and analytics.\n\n### 🚀 Key Features:\n- ✅ Logs request method, path, response time, and status code.\n- ✅ Supports multiple formats: text, json, and slog (structured logging).\n- ✅ Helps track API usage and debugging.\n- ✅ Customizable log patterns and additional fields.\n\n### 📝 Default Logging \nThis example applies simple logging.\n\n```go\npackage main\n\nimport (\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/logger\"\n)\n\nfunc main() {\n\n\tq := quick.New()\n\tq.Use(logger.New())\n\n\tq.Use(logger.New(logger.Config{\n\t\tLevel: \"DEGUB\",\n\t}))\n\n\tq.Use(logger.New(logger.Config{\n\t\tLevel: \"WARN\",\n\t}))\n\n\tq.Get(\"/v1/logger\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\n\t\treturn c.Status(200).JSON(quick.M{\n\t\t\t\"msg\": \"Quick ❤️\",\n\t\t})\n\t})\n\n\tq.Listen(\"0.0.0.0:8080\")\n}\n```\n\n### 📌 cURL \n\nText Logging\n```bash\n$ curl -i -XGET http://localhost:8080/v1/logger\n```\n### Console:\n![Quick Logger Example](readmeLogs/log.simple.png)\n\n---\n\n### 📝 Structured Logging(Text Format)\nThis example applies logging in text format with custom log fields.\n\n```go\npackage main\n\nimport (\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/logger\"\n)\n\nfunc main() {\n\n\tq := quick.New()\n\n\tq.Use(logger.New(logger.Config{\n\t\tFormat:  \"text\",\n\t\tPattern: \"[${level}] ${time} ${ip} ${method} ${status} - ${latency} user_id=${user_id} trace=${trace}\\n\",\n\t\tLevel:   \"DEBUG\",\n\t\tCustomFields: map[string]string{\n\t\t\t\"user_id\": \"usr-001\",\n\t\t\t\"trace\":   \"trace-debug\",\n\t\t},\n\t}))\n\n\tq.Use(logger.New(logger.Config{\n\t\tFormat:  \"text\",\n\t\tPattern: \"[${level}] ${time} ${ip} ${method} ${status} - ${latency} user_id=${user_id} trace=${trace}\\n\",\n\t\tLevel:   \"INFO\",\n\t\tCustomFields: map[string]string{\n\t\t\t\"user_id\": \"usr-002\",\n\t\t\t\"trace\":   \"trace-info\",\n\t\t},\n\t}))\n\n\tq.Use(logger.New(logger.Config{\n\t\tFormat:  \"text\",\n\t\tPattern: \"[${level}] ${time} ${ip} ${method} ${status} - ${latency} user_id=${user_id} trace=${trace}\\n\",\n\t\tLevel:   \"WARN\",\n\t\tCustomFields: map[string]string{\n\t\t\t\"user_id\": \"usr-003\",\n\t\t\t\"trace\":   \"trace-warn\",\n\t\t},\n\t}))\n\n\t// Definir rota GET para gerar logs\n\tq.Get(\"/v1/logger\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\n\t\t// Retornar resposta JSON\n\t\treturn c.Status(200).JSON(quick.M{\n\t\t\t\"msg\": \"Quick ❤️\",\n\t\t})\n\t})\n\n\t// Iniciar o servidor na porta 8080\n\tq.Listen(\"0.0.0.0:8080\")\n}\n\n```\n### 📌 cURL \n\nText Logging\n```bash\n$ curl -i -XGET http://localhost:8080/v1/logger\n```\n### Console:\n![Quick Logger Example](readmeLogs/log.format.text.png)\n\n---\n### 🛠️ Structured Logging (Slog Format)\n\nThis example uses structured logging (slog) for better log parsing.\n\n```go\npackage main\n\nimport (\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/logger\"\n)\n\n\nfunc main() {\n\n\tq := quick.New()\n\n\t// Apply the logger middleware with structured logging (slog)\n\tq.Use(logger.New(logger.Config{\n\t\tFormat: \"slog\",\n\t\tLevel:  \"DEBUG\",\n\t\tPattern: \"[${level}] ${ip} ${method} ${path} - ${latency} \" +\n\t\t\t\"user=${user_id} trace=${trace}\\n\",\n\t\tCustomFields: map[string]string{\n\t\t\t\"user_id\": \"99999\",\n\t\t\t\"trace\":   \"trace-debug\",\n\t\t},\n\t}))\n\n\t// Apply the logger middleware with structured logging (slog)\n\tq.Use(logger.New(logger.Config{\n\t\tFormat: \"slog\",\n\t\tLevel:  \"INFO\",\n\t\tPattern: \"[${level}] ${ip} ${method} ${path} - ${latency} \" +\n\t\t\t\"user=${user_id} trace=${trace}\\n\",\n\t\tCustomFields: map[string]string{\n\t\t\t\"user_id\": \"99999\",\n\t\t\t\"trace\":   \"trace-info\",\n\t\t},\n\t}))\n\n\t// Apply the logger middleware with structured logging (slog)\n\tq.Use(logger.New(logger.Config{\n\t\tFormat: \"slog\",\n\t\tLevel:  \"WARN\",\n\t\tPattern: \"[${level}] ${ip} ${method} ${path} - ${latency} \" +\n\t\t\t\"user=${user_id} trace=${trace}\\n\",\n\t\tCustomFields: map[string]string{\n\t\t\t\"user_id\": \"99999\",\n\t\t\t\"trace\":   \"trace-warn\",\n\t\t},\n\t}))\n\n\t// Define a test route\n\tq.Get(\"/v1/logger/slog\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\n\t\treturn c.Status(200).JSON(quick.M{\n\t\t\t\"msg\": \"Structured logging with slog\",\n\t\t})\n\t})\n\n\t// Start the server\n\tq.Listen(\"0.0.0.0:8080\")\n}\n\n```\n### 📌 cURL \n\n Structured Logging (Slog)\n```bash\n$ curl -i -XGET http://localhost:8080/v1/logger/slog\n```\n### Console:\n![Quick Logger Example](readmeLogs/log.format.slog.png)\n\n---\n### 📦 JSON Logging (Machine-Readable)\n\nIdeal for log aggregation systems, this example logs in JSON format.\n\n```go\npackage main\n\nimport (\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/logger\"\n)\n\nfunc main() {\n\n\tq := quick.New()\n\n\t// Apply logger with JSON format\n\tq.Use(logger.New(logger.Config{\n\t\tFormat: \"json\",\n\t\tLevel:  \"INFO\",\n\t}))\n\n\tq.Use(logger.New(logger.Config{\n\t\tFormat:  \"json\",\n\t\tPattern: \"[${level}] ${time} ${ip} ${method} ${status} - ${latency} user_id=${user_id} trace=${trace}\\n\",\n\t\tLevel:   \"DEBUG\",\n\t\tCustomFields: map[string]string{\n\t\t\t\"user_id\": \"usr-001\",\n\t\t\t\"trace\":   \"trace-debug\",\n\t\t},\n\t}))\n\n\t// Apply the logger middleware with structured logging (slog)\n\tq.Use(logger.New(logger.Config{\n\t\tFormat: \"json\",\n\t\tLevel:  \"WARN\",\n\t\tPattern: \"[${level}] ${ip} ${method} ${path} - ${latency} \" +\n\t\t\t\"user=${user_id} trace=${trace}\\n\",\n\t\tCustomFields: map[string]string{\n\t\t\t\"user_id\": \"usr-001\",\n\t\t\t\"trace\":   \"trace-warn\",\n\t\t},\n\t}))\n\n\t// Define an endpoint that triggers logging\n\tq.Get(\"/v1/logger/json\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\n\t\treturn c.Status(200).JSON(quick.M{\n\t\t\t\"msg\": \"JSON logging example\",\n\t\t})\n\t})\n\n\t// Start the server\n\tq.Listen(\"0.0.0.0:8080\")\n}\n```\n### 📌 cURL \n\nJSON Logging\n```bash\n$ curl -i -XGET http://localhost:8080/v1/logger/json\n```\n### Console:\n![Quick Logger Example](readmeLogs/log.format.json.png)\n\n---\n## 🆔 MsgUUID Middleware \n\n### 📌 Overview\n\nThe MsgUUID Middleware in Quick is responsible for automatically generating a unique identifier (UUID) for each incoming HTTP request. This identifier is added to the response headers, allowing better tracking, debugging, and log correlation in distributed systems.\n\n---\n\n### 🚀 How It Works\nThe MsgUUID Middleware works by:\n\n- Intercepts each incoming HTTP request before processing.\n- Generating a unique UUID for each request.\n- Attaching the generated UUID to the response headers for tracking.\n- Helping log correlation and debugging across distributed systems.\n\n---\n\n### ✅ Key Features  \n\n| Feature                    | Benefit                                                     |\n|----------------------------|-------------------------------------------------------------|\n| 🆔 **Unique Identifier**   | Adds a UUID to each request for tracking and correlation.  |\n| 🔄 **Automatic Generation** | No need for manual UUID creation, added seamlessly.       |\n| 📊 **Enhanced Debugging**   | Makes log analysis easier by attaching request identifiers. |\n| 🚀 **Lightweight \u0026 Fast**   | Does not impact performance, operates efficiently.         |\n\n---\n\nThis example generates a unique request identifier with the MsgUUUID middleware.\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/msguuid\"\n)\n\nfunc main() {\n\tq := quick.New()\n\n\t// Apply MsgUUID Middleware globally\n\tq.Use(msguuid.New())\n\n\t// Define an endpoint that responds with a UUID\n\tq.Get(\"/v1/msguuid/default\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\n\t\t// Log headers to validate UUID presence\n\t\tfmt.Println(\"Headers:\", c.Response.Header())\n\n\t\t// Return a 200 OK status\n\t\treturn c.Status(200).JSON(nil)\n\t})\n\n\tlog.Fatal(q.Listen(\"0.0.0.0:8080\"))\n}\n```\n### 📌 cURL \n\n```bash\n$ curl -i -XGET http://localhost:8080/v1/msguuid/default\n```\n### 📌 Response \n```bash\n\"Headers\":\"map\"[\n   \"Content-Type\":[\"application/json\"],\n   \"Msguuid\":[5f49cf4d-b62e-4d81-b46e-5125b52058a6]\n]\n```\n---\n## 📩 MsgID Middleware - Quick Framework \n\nThe `MsgID Middleware`  automatically assigns a unique identifier (MsgID) to each request. This helps with tracking, debugging, and log correlation in distributed systems.\n\n### 🚀 Overview\n- Automatically generates a unique MsgID for every incoming request.\n- Ensures traceability across microservices and distributed applications.\n- Adds the MsgID to both request and response headers.\n- Lightweight \u0026 fast, with minimal performance overhead.\n\n---\n\n## ✅ Key Features\n\n| Feature                     | Benefit                                                       |\n|-----------------------------|---------------------------------------------------------------|\n| 🆔 **Unique Identifier**    | Adds a MsgID to each request for tracking and correlation.   |\n| 🔄 **Automatic Generation** | No need for manual MsgID creation, added seamlessly.         |\n| 📊 **Enhanced Debugging**   | Makes log analysis easier by attaching request identifiers.  |\n| 🚀 **Lightweight \u0026 Fast**   | Minimal performance impact, operates efficiently.            |\n\n---\n### ⚙️ How It Works\nThe MsgID Middleware intercepts each incoming HTTP request.\nIt checks if the request already has a MsgID in the headers.\nIf not present, it generates a new MsgID and attaches it to:\n- The request headers (Msgid)\n- The response headers (Msgid)\n\nThe next middleware or handler processes the request with the assigned MsgID.\n\nHere is an example of how to use the `MsgID Middleware` with Quick:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/msguuid\"\n)\n\nfunc main() {\n\tq := quick.New()\n\n\t// Apply MsgUUID Middleware globally\n\tq.Use(msguuid.New())\n\n\t// Define an endpoint that responds with a UUID\n\tq.Get(\"/v1/msguuid/default\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\n\t\t// Log headers to validate UUID presence\n\t\tfmt.Println(\"Headers:\", c.Response.Header())\n\n\t\t// Return a 200 OK status\n\t\treturn c.Status(200).JSON(nil)\n\t})\n\n\tlog.Fatal(q.Listen(\"0.0.0.0:8080\"))\n}\n```\n### 📌 cURL\n```bash\n$ curl -i -X GET http://localhost:8080/v1/msguuid/default\n```\n\n### 📌 Response\n```bash\n{\n  \"msgid\": \"974562398\"\n}\n```\n---\n## 🛡️ Helmet \n\n**Helmet** is a middleware this package provides sensible security defaults while allowing full customization.\n\n---\n\n### ✅ Key Features\n\n- Sets common security-related HTTP headers\n- Provides secure defaults\n- Easily customizable via `Options` struct\n- Supports skipping middleware per request\n\n---\n\n### 🛡️ Default Headers\n\n| Feature                                             | Status | Notes / Observations                                 |\n|-----------------------------------------------------|:------:|------------------------------------------------------|\n| `X-XSS-Protection` header                           |   ✅   | Legacy protection, still included                    |\n| `X-Content-Type-Options: nosniff` header            |   ✅   | Prevents MIME sniffing attacks                       |\n| `X-Frame-Options` header                            |   ✅   | Helps prevent clickjacking                           |\n| `Content-Security-Policy` header                    |   ✅   | Defaults to `default-src 'self'`                     |\n| `CSPReportOnly` support                             |   ✅   | Optional report-only mode for CSP                    |\n| `Referrer-Policy` header                            |   ✅   | Defaults to `no-referrer`                            |\n| `Permissions-Policy` header                         |   ✅   | Controls browser features like camera, mic, etc.     |\n| `Strict-Transport-Security (HSTS)` support          |   ✅   | Adds HSTS for HTTPS requests                         |\n| HSTS options: `maxAge`, `includeSubDomains`, `preload` | ✅   | Fully customizable                                  |\n| `Cache-Control` header                              |   ✅   | Defaults to no-cache, improves response integrity    |\n| `Cross-Origin-Embedder-Policy` header               |   ✅   | Required for certain advanced browser APIs           |\n| `Cross-Origin-Opener-Policy` header                 |   ✅   | Isolates browsing contexts                           |\n| `Cross-Origin-Resource-Policy` header               |   ✅   | Restricts resource access                            |\n| `Origin-Agent-Cluster` header                       |   ✅   | Enables memory isolation in browsers                 |\n| `X-DNS-Prefetch-Control` header                     |   ✅   | Controls browser DNS prefetching                     |\n| `X-Download-Options` header                         |   ✅   | Prevents automatic downloads (IE-specific)           |\n| `X-Permitted-Cross-Domain-Policies` header          |   ✅   | Blocks Flash and Silverlight legacy access           |\n| `Next func(c)` to skip middleware dynamically       |   ✅   | Allows conditional header injection per route        |\n| Secure defaults applied when no options are provided|   ✅   | Based on OWASP and best practices                    |\n| Option naming compatible with Fiber                 |   ✅   | Enables easier migration from Fiber to Quick         |\n| Built-in TLS simulation support in `Qtest`          |   ✅   | Enables full testing of HTTPS-only behavior          |\n| Full HTTP method coverage in `Qtest`                |   ✅   | GET, POST, PUT, PATCH, DELETE, OPTIONS supported     |\n| Extended Qtest assertions (headers, body, etc.)     |   ✅   | Includes `AssertString`, `AssertNoHeader`, and more  |\n\n---\n\nExample basic configuration of helmet with header output\n```go\npackage main\n\nimport (\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/seuusuario/helmet\"\n)\n\nfunc main() {\n\tq := quick.New()\n\n\t// Use Helmet middleware with default security headers\n\tq.Use(helmet.Helmet())\n\n\t// Simple route to test headers\n\tq.Get(\"/v1/user\", func(c *quick.Ctx) error {\n\n\t\t// list all headers\n\t\theaders := make(map[string]string)\n\t\tfor k, v := range c.Response.Header() {\n\t\t\tif len(v) \u003e 0 {\n\t\t\t\theaders[k] = v[0]\n\t\t\t}\n\t\t}\n\t\treturn c.Status(200).JSONIN(headers)\n\t})\n\n\tq.Listen(\"0.0.0.0:8080\")\n}\n```\n### 📌 cURL\n```bash\n$ curl -X GET 'http://localhost:8080/v1/user'\n```\n\n### 📌 Response \n\n```bash\n{\n  \"Cache-Control\": \"no-cache, no-store, must-revalidate\",\n  \"Content-Security-Policy\": \"default-src 'self'\",\n  \"Cross-Origin-Embedder-Policy\": \"require-corp\",\n  \"Cross-Origin-Opener-Policy\": \"same-origin\",\n  \"Cross-Origin-Resource-Policy\": \"same-origin\",\n  \"Origin-Agent-Cluster\": \"?1\",\n  \"Referrer-Policy\": \"no-referrer\",\n  \"X-Content-Type-Options\": \"nosniff\",\n  \"X-DNS-Prefetch-Control\": \"off\",\n  \"X-Download-Options\": \"noopen\",\n  \"X-Frame-Options\": \"SAMEORIGIN\",\n  \"X-Permitted-Cross-Domain-Policies\": \"none\",\n  \"X-XSS-Protection\": \"0\"\n}\n```\n\n## ✨ Using `M` as an Alias for `map[string]interface{}`\n\nThe M type is a convenient alias for `map[string]interface{}` in Quick, making JSON response creation cleaner and more readable.\n\n\n### 🔹 In traditional Go code, you would use a `map[string]interface{}` explicitly when returning JSON responses:\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick\"\n)\n\nfunc main() {\n\tq := quick.New()\n\n\t// Define a GET route at \"/ping\"\n\tq.Get(\"/ping\", func(c *quick.Ctx) error {\n\t\tc.Status(200) // Set the HTTP status code\n\t\treturn c.JSON(map[string]interface{}{\n\t\t\t\"message\": \"pong\", // JSON response message\n\t\t})\n\t})\n\n\t// Start the Quick server\n\tlog.Fatal(q.Listen(\"0.0.0.0:8080\"))\n}\n```\n### 🔹 Using `quick.M`, you can simplify the JSON response declaration:\n\n```go\npackage main\n\nimport (\n    \"github.com/jeffotoni/quick\"\n)\n\nfunc main() {\n    app := quick.New()\n\n    app.Get(\"/ping\", func(c *quick.Context) {\n        c.JSON(200, quick.M{\n            \"message\": \"pong\",\n        })\n    })\n\n    app.Run()\n}\n\n```\n### 📌 Why Use M?\n\n- Less Boilerplate: Eliminates repetitive map[string]interface{} syntax.\n- Readability: Improves code readability, making JSON responses more intuitive.\n- Convenience: Makes it easier to return JSON responses in handlers.\n\n---\n## 🎗️ Recover \n\nThe **Recover** middleware provides a robust way to intercept and gracefully handle panics during HTTP request processing.\n\nInstead of allowing your application to crash due to an unexpected panic, this middleware recovers from it, logs the error, and returns a `500 Internal Server Error` response. Optionally, it can also print the stack trace to help with debugging.\n\n---\n\n### ✨ Features\n\n- ✅ Recovers from panics without crashing the server  \n- 🧠 Optionally logs stack traces for debugging  \n- 🔌 Custom error handling via `StackTraceHandler`  \n- 🔄 Can be conditionally skipped with `Next()` function  \n\n---\n\nThis example demonstrating how to use the `Recover` middleware in a Quick application.  \nThis middleware protects your app by recovering from unexpected panics during request handling,  \nlogging the error (optionally with a stack trace), and returning a `500 Internal Server Error` to the client.\n\nIn this example, the route `/v1/recover` intentionally triggers a panic.  \nThanks to the `Recover` middleware, the server won't crash — instead, it will return a proper error response.\n\n```go\npackage main\n\nimport (\n\t\"errors\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/recover\"\n)\n\nfunc main() {\n\tq := quick.New()\n\n\t// Apply the Recover middleware\n\tq.Use(recover.New(recover.Config{\n\t\tApp: q,\n\t}))\n\n\t// Define a test route\n\tq.Get(\"/v1/recover\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"application/json\")\n\n\t\t// halt the server\n\t\tpanic(errors.New(\"Panicking!\"))\n\t})\n\n\t// Start the server\n\tq.Listen(\"0.0.0.0:8080\")\n}\n``` \n### 📌 cURL\n```bash\n$ curl -i -X GET http://localhost:8080/v1/recover\n```\n\n### 📌 Response \n```bash\nHTTP/1.1 500 Internal Server Error\nContent-Type: text/plain; charset=utf-8\n\nInternal Server Error\n```\n---\n### ⚙️ Configuration Options\n\nYou can configure the behavior of the middleware using the `recover.Config` struct:\n\n| Field              | Type                                      | Description                                                                 |\n|-------------------|-------------------------------------------|-----------------------------------------------------------------------------|\n| `EnableStacktrace` | `bool`                                    | Whether to print the stack trace to `stderr`. Defaults to `true`.          |\n| `Next`            | `func(c *quick.Ctx) bool`                 | Skips the middleware if the function returns `true`. Optional.             |\n| `StackTraceHandler` | `func(c *quick.Ctx, err interface{})`     | Custom function to handle the panic. Useful for error tracking/logging.    |\n\n---\n\n## 🛠️ Healthcheck \n\nThe **Healthcheck** middleware provides a simple and customizable way to monitor your application’s health status.\n\nThis is especially useful in cloud-native applications and containerized environments (e.g., Docker, Kubernetes), where automated systems frequently check endpoints to determine if the application is healthy and responsive.\n\n---\n\n### ✨ Features\n\n- ✅ Lightweight and easy to use\n- 🔁 Custom health probe logic (e.g., database ping, cache status)\n- 🌐 Customizable endpoint path (default: `/healthcheck`)\n- 🎯 Optional `Next` function to conditionally skip middleware\n- 🧩 Designed for microservices and production-readiness\n\n---\n\nThis basic example demonstrating how to use the Healthcheck middleware with its default configuration.  \nIt registers a `/healthcheck` endpoint that responds with `200 OK` if the app is considered healthy.\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/seuusuario/healthcheck\"\n)\n\nfunc main() {\n\tq := quick.New()\n\n\t// Use Healthcheck middleware with default endpoint (/healthcheck)\n\tq.Use(healthcheck.New(\n\t\thealthcheck.Options{\n\t\t\tApp: q,\n\t\t},\n\t))\n\n\tq.Get(\"/\", func(c *quick.Ctx) error {\n\t\treturn c.Status(200).String(\"Home page\")\n\t})\n\n\tlog.Fatalln(q.Listen(\":8080\"))\n}\n```\n### 📌 cURL\n```bash\n$ curl -X GET http://localhost:8080/healthcheck\n```\n\n### 📌 Response \n\n```bash\nHTTP/1.1 200 OK\nContent-Type: text/plain; charset=utf-8\n\nOK\n```\n### ⚙️ Custom Configuration\nYou can fully customize the behavior of the middleware by using the Options struct. For example, changing the endpoint:\n\n```go\nq.Use(healthcheck.New(\n\thealthcheck.Options{\n\t\tApp:      q,\n\t\tEndpoint: \"/v1/health\",\n\t},\n))\n```\nYou can also define a **custom health probe** function, which runs whenever the endpoint is called:\n```go\nq.Use(healthcheck.New(\n\thealthcheck.Options{\n\t\tApp: q,\n\t\tProbe: func(c *quick.Ctx) bool {\n\t\t\t// Perform custom checks (e.g., database, cache)\n\t\t\treturn true // or false if unhealthy\n\t\t},\n\t},\n))\n```\n### 🔎 Advanced Configuration Options\n\n| Field     | Type                      | Description                                                                 |\n|-----------|---------------------------|-----------------------------------------------------------------------------|\n| `App`     | `*quick.Quick`            | The Quick application instance (**required**).                             |\n| `Endpoint`| `string`                  | The route path to expose the healthcheck. Default: `/healthcheck`.        |\n| `Probe`   | `func(c *quick.Ctx) bool` | Optional function to perform custom health checks. Returns `true` or `false`. |\n| `Next`    | `func(c *quick.Ctx) bool` | Skips the middleware when it returns `true`. Useful for conditional logic. |\n\n---\n## 🖼️ Template Engine\n\n\nThis package provides a flexible and extensible **template rendering engine** for the Quick web framework.  \nIt allows you to build dynamic HTML views using Go's standard `html/template` package, enriched with features like layout support, custom functions, and file system abstraction.\n\n---\n\n## 📌 What is a Template?\n\nIn web development, a **template** is a file that defines the structure of the output (usually HTML) with dynamic placeholders.  \nYou can inject data into these placeholders at runtime to render personalized content for each request.\n\n---\n### 🚀 Features\n\n- ✅ Supports rendering templates with optional layout wrapping\n- 🔁 Nested layouts (`base.html` wrapping `main.html` wrapping `index.html`)\n- 🔧 Custom template functions via `AddFunc`\n- 📁 Loads templates from local file system or embedded `fs.FS` (e.g., `embed.FS`)\n- 📦 Fully compatible with Go’s `html/template`\n---\n### 🏗️ HTML Engine\nThe html.Engine is a ready-to-use implementation that supports:\n\n- File system loading (local or embedded)\n- Custom template functions\n- Layout composition\n---\n\n## 🧩 Rendering Templates with and without Layouts\n\nThe example below shows how to render templates in Quick using:\n\n- A **basic template** (`/`)\n- A template wrapped with a **single layout** (`/layout`)\n- A template wrapped with **nested layouts** (`/layout-nested`)\n\nIt also demonstrates how to register custom template functions (e.g., `upper`) and how to configure the `html.Engine` to load `.html` files from the `views/` directory.\n\n---\n### 📁 Project Structure\n\n```text\n.\n├── main.go\n└── views/\n    ├── index.html\n    └── layouts/\n        ├── main.html\n        └── base.html\n```\n\n```go\n\npackage main\n\nimport (\n\t\"strings\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/template/html\"\n)\n\nfunc main() {\n\tengine := html.New(\"./views\", \".html\")\n\n\t// Example of adding a custom function\n\tengine.AddFunc(\"upper\", strings.ToUpper)\n\tengine.Load()\n\n\tapp := quick.New(quick.Config{\n\t\tViews: engine,\n\t})\n\n\tapp.Get(\"/\", func(c *quick.Ctx) error {\n\t\treturn c.HTML(\"index\", map[string]interface{}{\n\t\t\t\"Title\":   \"Quick + Templates\",\n\t\t\t\"Message\": \"this is your index content in views\",\n\t\t})\n\t})\n\n\tapp.Get(\"/layout\", func(c *quick.Ctx) error {\n\t\treturn c.HTML(\"index\", map[string]interface{}{\n\t\t\t\"Title\":   \"Quick with Layout\",\n\t\t\t\"Message\": \"layout with main.html\",\n\t\t}, \"layouts/main\")\n\t})\n\n\tapp.Get(\"/layout-nested\", func(c *quick.Ctx) error {\n\t\treturn c.HTML(\"index\", map[string]interface{}{\n\t\t\t\"Title\":   \"Nested Layouts\",\n\t\t\t\"Message\": \"this is nested layout content\",\n\t\t}, \"layouts/main\", \"layouts/base\")\n\t})\n\n\tapp.Listen(\":8080\")\n}\n```\n\n## 📦 Rendering Templates with embed.FS (Go 1.16+)\n\nThis example demonstrates how to embed templates into your Go binary using the `embed` package.  \nThis is useful for distributing a single executable without external template files.\n\n---\n\n### 📁 Embedded Project Structure\n\n```text\nproject/\n├── main.go\n└── views/\n    ├── index.html\n    └── layouts/\n        ├── main.html\n        └── base.html\n```\n### 🧩 Example Using embed.FS\n```go\npackage main\n\nimport (\n\t\"embed\"\n\t\"strings\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/template/html\"\n)\n\n//go:embed views/*.html views/layouts/*.html\nvar viewsFS embed.FS\n\nfunc main() {\n\tengine := html.NewFileSystem(viewsFS, \".html\")\n\tengine.Dir = \"views\" // required for path normalization\n\tengine.AddFunc(\"upper\", strings.ToUpper)\n\tengine.Load()\n\n\tapp := quick.New(quick.Config{\n\t\tViews: engine,\n\t})\n\n\tapp.Get(\"/\", func(c *quick.Ctx) error {\n\t\treturn c.HTML(\"index\", map[string]interface{}{\n\t\t\t\"Title\":   \"Quick + Templates (embed)\",\n\t\t\t\"Message\": \"this is your index content in views (embedded)\",\n\t\t})\n\t})\n\n\tapp.Get(\"/layout\", func(c *quick.Ctx) error {\n\t\treturn c.HTML(\"index\", map[string]interface{}{\n\t\t\t\"Title\":   \"Quick with Layout\",\n\t\t\t\"Message\": \"layout with main.html\",\n\t\t}, \"layouts/main\")\n\t})\n\n\tapp.Get(\"/layout-nested\", func(c *quick.Ctx) error {\n\t\treturn c.HTML(\"index.html\", map[string]interface{}{\n\t\t\t\"Title\":   \"Nested Layouts\",\n\t\t\t\"Message\": \"this is nested layout content\",\n\t\t}, \"layouts/main\", \"layouts/base\")\n\t})\n\n\tapp.Listen(\":8080\")\n}\n```\n### 📌 cURL\n```bash\ncurl -i http://localhost:8080/\ncurl -i http://localhost:8080/layout\ncurl -i http://localhost:8080/layout-nested\n```\n---\n### 🔍 Local Filesystem vs embed.FS: When to Use Each?\n\nThe `html.Engine` supports both loading templates from disk (`html.New`) and embedding them in the binary (`html.NewFileSystem`).  \nHere’s a comparison to help you choose the best option for your project:\n\n| Feature                         | Local Filesystem (`html.New`)             | Embedded Filesystem (`html.NewFileSystem`)        |\n|---------------------------------|-------------------------------------------|----------------------------------------------------|\n| 📂 Files stored externally       | ✅ Yes                                     | ❌ No (compiled into binary)                        |\n| 📦 Single binary deployment     | ❌ No (requires template files)           | ✅ Yes (no external files needed)                   |\n| 🔁 Changes reflect on restart   | ✅ Yes                                     | ❌ No (requires recompilation)                      |\n| 🚀 Ideal for development        | ✅ Fast iteration and preview              | ⚠️ Requires rebuild for every change                |\n| 🔒 Ideal for production         | ⚠️ Needs extra steps to bundle files       | ✅ Safer and cleaner deploy                         |\n| ⚙️ Config example               | `html.New(\"./views\", \".html\")`            | `html.NewFileSystem(viewsFS, \".html\")`             |\n\n---\n## 🧠 PPROF \n\n**pprof** provides profiling endpoints for your Quick application. It helps you to identify \nperformance bottlenecks, monitor resource usage, and ensure that the code runs efficiently\n\n---\n### 🔻 Environment\nProfiling is only enabled in development mode (APP_ENV=development). \n\nWe strongly recommend to use it only in development mode because in production it can introduce\nunwanted overhead and potentially degrade performance.\n\n---\n### 🧩 Example Usage\n```go\npackage main\n\nimport (\n\t\"errors\"\n\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/pprof\"\n)\n\nfunc main() {\n\tq := quick.New()\n\n\t// Apply the Profiling middleware\n\tq.Use(pprof.New())\n\n\t// Define a test route\n\tq.Get(\"/\", func(c *quick.Ctx) error {\n\t\tc.Set(\"Content-Type\", \"text/plain\")\n\t\treturn c.Status(quick.StatusOK).String(\"OK\")\n\t})\n\n\t// Start the server\n\tq.Listen(\"0.0.0.0:8080\")\n}\n```\n\n---\n### Routes\n\nProfiling middleware registers a set of routes for profiling:\n\n- `/debug/pprof`\n- `/debug/cmdline`\n- `/debug/profile`\n- `/debug/symbol`\n- `/debug/pprof/trace`\n- `/debug/goroutine`\n- `/debug/heap`\n- `/debug/threadcreate`\n- `/debug/mutex`\n- `/debug/allocs`\n- `/debug/block`\n\n---\n\n### Let's test our pprof\n\nSo that we can view the graphical form of our pprof in the browser, we will install the package graphviz.\n\nFor Mac\n```bash\n$ brew install graphviz\n```\n\nFor Linux\n```bash\n$ apt install graphviz\n```\n\n```go\n\npackage main\n\nimport (\n\t\"github.com/jeffotoni/quick\"\n\t\"github.com/jeffotoni/quick/middleware/pprof\"\n)\n\nfunc main() {\n\tq := quick.New()\n\n\tq.Use(pprof.New())\n\n\tq.Get(\"/busy\", func(c *quick.Ctx) error {\n\t\t// Simulates a load\n\t\tsum := 0\n\t\tfor i := 0; i \u003c 1e7; i++ {\n\t\t\tsum += i\n\t\t}\n\t\treturn c.String(\"done\")\n\t})\n\n\t// Mandatory route for pprof to work correctly\n\tq.Get(\"/debug/pprof*\", func(c *quick.Ctx) error {\n\t\treturn c.Next()\n\t})\n\n\tq.Listen(\"0.0.0.0:8080\")\n}\n\n```\n\n```bash\n$ go run main.go\n```\n\nLet's generate a small load in our API\n```bash\n$ while true; do curl -s http://localhost:8080/busy \u003e /dev/null; done\n```\n\n\n### Check if pprof is active\n\nIn Browser\n```browser\nhttp://localhost:8080/debug/pprof/\n```\n\n### You will see the list:\n- allocs\n- block\n- cmdline\n- goroutine\n- heap\n- mutex\n- profile\n- threadcreate\n- trace\n\n---\n\n## 📚| More Examples\n\nThis directory contains **practical examples** of the **Quick Framework**, a **fast and lightweight web framework** developed in Go. \n\nThe examples are organized in **separate folders**, each containing a complete example of using the framework in a simple web application.\n\n### 📌 Want to contribute?\nIf you have some interesting example of using the **Quick Framework**, feel free to send a **Pull Request(PR)** with your contribution. \n\n### 👉 Check out the official example repository: \n🔗 [Quick Framework Examples](https://github.com/jeffotoni/quick/tree/main/example)\n\n\n\n### 🤝| Contributions \u0026 Community Support\n\nWe already have several examples, and we can already test and play 😁. Of course, we are at the beginning, still has much to do.\nFeel free to do **PR** (at risk of winning a Go t-shirt ❤️ and of course recognition as a professional Go 😍 in the labor market).\n\n### 👋 **New to the project? Start here:**  \nCheck out our [First Contact Improvements Guide](https://github.com/jeffotoni/quick/blob/main/CONTRIBUTING.md)\n to get up and running smoothly!\n\n\n### 🚀 **Quick Project Supporters** 🙏\n\nThe Quick Project aims to develop and provide quality software for the developer community. 💻 To continue improving our tools, we rely on the support of our sponsors in Patreon. 🤝\n\nWe thank all our supporters! 🙌 If you also believe in our work and want to contribute to the advancement of the development community, consider supporting Project Quick on our Patreon [click here](https://patreon.com/go_quick)\n\nTogether we can continue to build amazing tools! 🚀\n\n\n\n| 👤 **Avatar**                                                                                                         | 🔥 **User**                                                   | 💰 **Donation** |\n|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|----------------|\n| \u003cimg src=\"https://avatars.githubusercontent.com/u/1092879?s=96\u0026v=4\" height=\"40\"\u003e                                     | [@jeffotoni](https://github.com/jeffotoni)                     | ⭐ x 10       |\n| \u003cimg src=\"https://avatars.githubusercontent.com/u/99341377?s=400\u0026u=095679b08054e215561a4d4b08da764c2de619e6\u0026v=4\" height=\"40\"\u003e | [@Crow3442](https://github.com/Crow3442)                       | ⭐ x 5        |\n| \u003cimg src=\"https://avatars.githubusercontent.com/u/70351793?v=4\" height=\"40\"\u003e                                         | [@Guilherme-De-Marchi](https://github.com/Guilherme-De-Marchi) | ⭐ x 5        |\n| \u003cimg src=\"https://avatars.githubusercontent.com/u/59976892?v=4\" height=\"40\"\u003e                                         | [@jaquelineabreu](https://github.com/jaquelineabreu)           | ⭐ x 5        |\n| \u003cimg src=\"https://avatars.githubusercontent.com/u/38386200?v=4\" height=\"40\"\u003e                                         | [@emmadal](https://github.com/emmadal)           | ⭐ x 5        |\n \n \n","funding_links":["https://patreon.com/go_quick"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeffotoni%2Fquick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeffotoni%2Fquick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeffotoni%2Fquick/lists"}