1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-21 20:33:08 +00:00

Merge remote-tracking branch 'origin/master' into UUID_thread_safe

This commit is contained in:
ReneWerner87 2020-09-15 10:42:53 +02:00
commit 4995d49921
26 changed files with 459 additions and 326 deletions

32
.github/README.md vendored
View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -176,7 +176,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -198,7 +198,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -227,7 +227,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -269,7 +269,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -386,7 +386,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -416,7 +416,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -473,7 +473,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -483,6 +483,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -499,7 +500,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -512,16 +513,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 Contribute

View File

@ -95,7 +95,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -194,7 +194,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -220,7 +220,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -252,7 +252,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -299,7 +299,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -437,7 +437,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</div>
@ -470,7 +470,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</div>
@ -536,7 +536,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</div>
@ -547,6 +547,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -563,7 +564,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -576,16 +577,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 Third Party Middlewares
هذه قائمة middlewares التي تم إنشاؤها من قبل المجتمع Fiber , الرجاء إنشاءPR إذا كنت تريد أن ترى ذلك!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 مساهمة

32
.github/README_de.md vendored
View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -176,7 +176,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -198,7 +198,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -227,7 +227,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -269,7 +269,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -386,7 +386,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -416,7 +416,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -473,7 +473,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -483,6 +483,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -499,7 +500,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -512,16 +513,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 Mitwirken

32
.github/README_es.md vendored
View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -176,7 +176,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -198,7 +198,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -227,7 +227,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -269,7 +269,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -386,7 +386,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -416,7 +416,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -473,7 +473,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -483,6 +483,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -499,7 +500,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -512,16 +513,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 Contribuir

32
.github/README_fr.md vendored
View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -176,7 +176,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -198,7 +198,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -227,7 +227,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -269,7 +269,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -386,7 +386,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -416,7 +416,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -473,7 +473,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -483,6 +483,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -499,7 +500,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -512,16 +513,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 Contribuer

63
.github/README_he.md vendored
View File

@ -97,7 +97,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -227,7 +227,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -252,7 +252,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -284,7 +284,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -330,7 +330,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</div>
@ -463,7 +463,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</div>
@ -496,7 +496,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</div>
@ -559,7 +559,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</div>
@ -579,6 +579,7 @@ Here is a list of middleware that are included within the Fiber framework.
<div dir="rtl">
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -593,23 +594,30 @@ Here is a list of middleware that are included within the Fiber framework.
</div>
## 🧬 Internal Middleware
<div dir="rtl">
## 🧬 External Middleware
</div>
<div dir="rtl">
Here is a list of middleware that are included within the Fiber framework.
</div>
<div dir="rtl">
| Middleware | Description |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](error-handling.md). |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware provides a key based authentication. |
| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware rewrites the URL path based on provided rules. It can be helpful for backward compatibility or just creating cleaner and more descriptive links. |
| [session](https://github.com/gofiber/session) | This session middleware is build on top of fasthttp/session by @savsgio MIT. Special thanks to @thomasvvugt for helping with this middleware. |
| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. |
| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! |
<div dir="rtl">
@ -623,16 +631,17 @@ This is a list of middlewares that are created by the Fiber community, please cr
<div dir="rtl">
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
</div>
<div dir="rtl">

32
.github/README_id.md vendored
View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -178,7 +178,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -200,7 +200,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -229,7 +229,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -271,7 +271,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -388,7 +388,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -418,7 +418,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -475,7 +475,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -485,6 +485,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -501,7 +502,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -514,16 +515,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 Berkontribusi

32
.github/README_ja.md vendored
View File

@ -91,7 +91,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
## 🤖 ベンチマーク
@ -179,7 +179,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -201,7 +201,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -230,7 +230,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -272,7 +272,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -389,7 +389,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -419,7 +419,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -476,7 +476,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -486,6 +486,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -502,7 +503,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -515,16 +516,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 貢献する

32
.github/README_ko.md vendored
View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -181,7 +181,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -203,7 +203,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -232,7 +232,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -274,7 +274,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -391,7 +391,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -421,7 +421,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -478,7 +478,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -488,6 +488,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -504,7 +505,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -517,16 +518,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 기여

33
.github/README_nl.md vendored
View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -180,7 +180,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -202,7 +202,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -231,7 +231,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -273,7 +273,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -390,7 +390,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -420,7 +420,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -477,7 +477,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -487,6 +487,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -503,7 +504,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -516,17 +517,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 Bijdragen
Om de actieve ontwikkelingen van `Fiber` te ondersteunen of om een **bedankje** te geven:

32
.github/README_pt.md vendored
View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -176,7 +176,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -198,7 +198,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -227,7 +227,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -267,7 +267,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -384,7 +384,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -414,7 +414,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -471,7 +471,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -481,6 +481,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -497,7 +498,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -510,16 +511,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 Middlewares Third Party
Esta é uma lista de middlewares criados pela comunidade do Fiber, se quiser ter o seu middleware aqui, é só abrir um PR!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 Contribuindo

32
.github/README_ru.md vendored
View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -178,7 +178,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -200,7 +200,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -229,7 +229,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -271,7 +271,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -388,7 +388,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -418,7 +418,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -475,7 +475,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -485,6 +485,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -501,7 +502,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -515,16 +516,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
Это список middlewares, созданных сообществом Fiber. Пожалуйста, [создайте PR](https://github.com/gofiber/fiber/pulls), если хотите добавить в этот список свой или известный вам middleware для веб фреймворка Fiber!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 Помощь проекту

32
.github/README_tr.md vendored
View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -174,7 +174,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -196,7 +196,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -225,7 +225,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -267,7 +267,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -383,7 +383,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -413,7 +413,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -470,7 +470,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -480,6 +480,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -496,7 +497,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -509,16 +510,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 Destek

View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -179,7 +179,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -201,7 +201,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -230,7 +230,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -272,7 +272,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -388,7 +388,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -418,7 +418,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -475,7 +475,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -485,6 +485,7 @@ func main() {
Here is a list of middleware that are included within the Fiber framework.
| Middleware | Description |
| :--- | :--- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
@ -501,7 +502,7 @@ Here is a list of middleware that are included within the Fiber framework.
List of externally hosted middleware modules and maintained by the [Fiber team](https://github.com/orgs/gofiber/people).
| Middleware | Description |
| :--- | :--- | :--- |
| :--- | :--- |
| [adaptor](https://github.com/gofiber/adaptor) | Converter for net/http handlers to/from Fiber request handlers, special thanks to @arsmn! |
| [helmet](https://github.com/gofiber/helmet) | Helps secure your apps by setting various HTTP headers. |
| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. |
@ -514,16 +515,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
## 🌱 第三方中间件
这是由`Fiber`社区创建的中间件列表,如果您想看到自己的中间件,请创建`PR`
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 贡献

View File

@ -90,7 +90,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -178,7 +178,7 @@ func main() {
return c.SendString(msg) // => ✋ /api/register
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -200,7 +200,7 @@ func main() {
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -229,7 +229,7 @@ func main() {
return c.SendString("Hello, World 👋!")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -269,7 +269,7 @@ func main() {
})
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -387,7 +387,7 @@ func main() {
// => 404 "Not Found"
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -417,7 +417,7 @@ func main() {
// => {"success":true, "message":"Hi John!"}
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -474,7 +474,7 @@ func main() {
panic("normally this would crash your app")
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
</details>
@ -514,16 +514,17 @@ List of externally hosted middleware modules and maintained by the [Fiber team](
由社群建立的中介器列表要新增請發PR!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [codemicro/fiber-cache](https://github.com/codemicro/fiber-cache)
- [itsursujit/fiber-boilerplate](https://github.com/itsursujit/fiber-boilerplate)
- [juandiii/go-jwk-security](https://github.com/juandiii/go-jwk-security)
- [kiyonlin/fiber_limiter](https://github.com/kiyonlin/fiber_limiter)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
## 👍 貢獻

4
app.go
View File

@ -706,9 +706,9 @@ func (app *App) startupMessage(addr string, tls bool, pids string) {
addr = "https://" + host + ":" + port
}
isPrefork := "disabled"
isPrefork := "Disabled"
if app.config.Prefork {
isPrefork = "enabled"
isPrefork = "Enabled"
}
out := colorable.NewColorableStdout()

View File

@ -433,15 +433,29 @@ func Test_App_New(t *testing.T) {
appConfig.Get("/", testEmptyHandler)
}
func Test_App_Shutdown(t *testing.T) {
func Test_App_Config(t *testing.T) {
app := New(Config{
DisableStartupMessage: true,
})
if err := app.Shutdown(); err != nil {
if err.Error() != "shutdown: server is not running" {
t.Fatal()
utils.AssertEqual(t, true, app.Config().DisableStartupMessage)
}
func Test_App_Shutdown(t *testing.T) {
t.Run("success", func(t *testing.T) {
app := New(Config{
DisableStartupMessage: true,
})
utils.AssertEqual(t, true, app.Shutdown() == nil)
})
t.Run("no server", func(t *testing.T) {
app := &App{}
if err := app.Shutdown(); err != nil {
if err.Error() != "shutdown: server is not running" {
t.Fatal()
}
}
}
})
}
// go test -run Test_App_Static_Index_Default
@ -750,7 +764,9 @@ func Test_App_Next_Method(t *testing.T) {
// go test -run Test_App_Listen
func Test_App_Listen(t *testing.T) {
app := New()
app := New(Config{DisableStartupMessage: true})
utils.AssertEqual(t, false, app.Listen(":99999") == nil)
go func() {
time.Sleep(1000 * time.Millisecond)
@ -758,13 +774,6 @@ func Test_App_Listen(t *testing.T) {
}()
utils.AssertEqual(t, nil, app.Listen(":4003"))
go func() {
time.Sleep(1000 * time.Millisecond)
utils.AssertEqual(t, nil, app.Shutdown())
}()
utils.AssertEqual(t, nil, app.Listen(":4010"))
}
// go test -run Test_App_Listener
@ -990,3 +999,8 @@ func Test_App_SmallReadBuffer(t *testing.T) {
utils.AssertEqual(t, nil, app.Listen(":4006"))
}
func Test_App_Master_Process_Show_Startup_Message(t *testing.T) {
New(Config{Prefork: true}).
startupMessage(":3000", true, "")
}

View File

@ -5,7 +5,9 @@
package fiber
import (
"crypto/tls"
"fmt"
"net"
"testing"
"time"
@ -300,3 +302,45 @@ func Benchmark_Utils_IsNoCache(b *testing.B) {
}
utils.AssertEqual(b, true, ok)
}
func Test_Utils_lnMetadata(t *testing.T) {
t.Run("closed listen", func(t *testing.T) {
ln, err := net.Listen("tcp", ":0")
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, nil, ln.Close())
addr, config := lnMetadata(ln)
utils.AssertEqual(t, ln.Addr().String(), addr)
utils.AssertEqual(t, true, config == nil)
})
t.Run("non tls", func(t *testing.T) {
ln, err := net.Listen("tcp", ":0")
utils.AssertEqual(t, nil, err)
addr, config := lnMetadata(ln)
utils.AssertEqual(t, ln.Addr().String(), addr)
utils.AssertEqual(t, true, config == nil)
})
t.Run("tls", func(t *testing.T) {
cer, err := tls.LoadX509KeyPair("./.github/testdata/ssl.pem", "./.github/testdata/ssl.key")
utils.AssertEqual(t, nil, err)
config := &tls.Config{Certificates: []tls.Certificate{cer}}
ln, err := net.Listen("tcp4", ":0")
utils.AssertEqual(t, nil, err)
ln = tls.NewListener(ln, config)
addr, config := lnMetadata(ln)
utils.AssertEqual(t, ln.Addr().String(), addr)
utils.AssertEqual(t, true, config != nil)
})
}

View File

@ -59,7 +59,7 @@ func main() {
Root: packr.New("Assets Box", "/assets"),
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -83,7 +83,7 @@ func main() {
Root: rice.MustFindBox("assets").HTTPBox(),
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -107,7 +107,7 @@ func main() {
Root: myEmbeddedFiles.HTTP,
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```
@ -137,7 +137,7 @@ func main() {
Root: statikFS,
})
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```

View File

@ -62,6 +62,9 @@ func New(config Config) fiber.Handler {
if !strings.HasPrefix(cfg.Index, "/") {
cfg.Index = "/" + cfg.Index
}
if cfg.NotFoundFile != "" && !strings.HasPrefix(cfg.NotFoundFile, "/") {
cfg.NotFoundFile = "/" + cfg.NotFoundFile
}
if cfg.Root == nil {
log.Fatal("filesystem: Root cannot be nil")
}

View File

@ -35,7 +35,6 @@ func New() fiber.Handler {
// Switch to original path without stripped slashes
switch path {
case "/debug/pprof/":
c.Context().SetContentType(fiber.MIMETextHTML)
pprofIndex(c.Context())
case "/debug/pprof/cmdline":
pprofCmdline(c.Context())

View File

@ -0,0 +1,88 @@
package pprof
import (
"bytes"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/utils"
"io/ioutil"
"net/http/httptest"
"testing"
)
func Test_Non_Pprof_Path(t *testing.T) {
app := fiber.New(fiber.Config{DisableStartupMessage: true})
app.Use(New())
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("escaped")
})
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", nil))
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 200, resp.StatusCode)
b, err := ioutil.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "escaped", string(b))
}
func Test_Pprof_Index(t *testing.T) {
app := fiber.New(fiber.Config{DisableStartupMessage: true})
app.Use(New())
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("escaped")
})
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/debug/pprof/", nil))
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 200, resp.StatusCode)
utils.AssertEqual(t, fiber.MIMETextHTMLCharsetUTF8, resp.Header.Get(fiber.HeaderContentType))
b, err := ioutil.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, bytes.Contains(b, []byte("<title>/debug/pprof/</title>")))
}
func Test_Pprof_Subs(t *testing.T) {
app := fiber.New(fiber.Config{DisableStartupMessage: true})
app.Use(New())
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("escaped")
})
subs := []string{
"cmdline", "profile", "symbol", "trace", "allocs", "block",
"goroutine", "heap", "mutex", "threadcreate",
}
for _, sub := range subs {
t.Run(sub, func(t *testing.T) {
target := "/debug/pprof/" + sub
if sub == "profile" {
target += "?seconds=1"
}
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, target, nil), 5000)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 200, resp.StatusCode)
})
}
}
func Test_Pprof_Other(t *testing.T) {
app := fiber.New(fiber.Config{DisableStartupMessage: true})
app.Use(New())
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("escaped")
})
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/debug/pprof/302", nil))
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 302, resp.StatusCode)
}

View File

@ -6,6 +6,7 @@ import (
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/utils"
@ -56,6 +57,8 @@ func Test_Proxy(t *testing.T) {
utils.AssertEqual(t, nil, target.Listen(":3001"))
}()
time.Sleep(time.Second)
resp, err := target.Test(httptest.NewRequest("GET", "/", nil), 2000)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, fiber.StatusTeapot, resp.StatusCode)
@ -116,6 +119,8 @@ func Test_Proxy_After_With_Error(t *testing.T) {
utils.AssertEqual(t, nil, target.Listen(":3002"))
}()
time.Sleep(time.Second)
resp, err := target.Test(httptest.NewRequest("GET", "/", nil), 2000)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, fiber.StatusTeapot, resp.StatusCode)

View File

@ -14,8 +14,8 @@ func Test_App_Prefork_Child_Process(t *testing.T) {
// Reset test var
testPreforkMaster = true
utils.AssertEqual(t, nil, os.Setenv(envPreforkChildKey, envPreforkChildVal))
defer os.Setenv(envPreforkChildKey, "")
setupIsChild(t)
defer teardownIsChild(t)
app := New()
@ -64,8 +64,8 @@ func Test_App_Prefork_Master_Process(t *testing.T) {
}
func Test_App_Prefork_Child_Process_Never_Show_Startup_Message(t *testing.T) {
utils.AssertEqual(t, nil, os.Setenv(envPreforkChildKey, envPreforkChildVal))
defer os.Setenv(envPreforkChildKey, "")
setupIsChild(t)
defer teardownIsChild(t)
rescueStdout := os.Stdout
defer func() { os.Stdout = rescueStdout }()
@ -83,3 +83,11 @@ func Test_App_Prefork_Child_Process_Never_Show_Startup_Message(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 0, len(out))
}
func setupIsChild(t *testing.T) {
utils.AssertEqual(t, nil, os.Setenv(envPreforkChildKey, envPreforkChildVal))
}
func teardownIsChild(t *testing.T) {
utils.AssertEqual(t, nil, os.Setenv(envPreforkChildKey, ""))
}

View File

@ -1,63 +0,0 @@
# Utils
[![Release](https://img.shields.io/github/release/gofiber/fiber.svg)](https://github.com/gofiber/fiber/releases)
[![Discord](https://img.shields.io/discord/704680098577514527?label=Discord&logo=discord&logoColor=white&color=7289DA)](https://gofiber.io/discord)
[![Test](https://github.com/gofiber/fiber/workflows/Test/badge.svg)](https://github.com/gofiber/utils/actions?query=workflow%3ATest)
[![Security](https://github.com/gofiber/fiber/workflows/Security/badge.svg)](https://github.com/gofiber/utils/actions?query=workflow%3ASecurity)
[![Linter](https://github.com/gofiber/fiber/workflows/Linter/badge.svg)](https://github.com/gofiber/utils/actions?query=workflow%3ALinter)
A collection of common functions but with better performance, less allocations and no dependencies created for [Fiber](https://github.com/gofiber/fiber).
```go
// go test -v -benchmem -run=^$ -bench=Benchmark_ -count=2
Benchmark_GetMIME/fiber 14287550 84.2 ns/op 0 B/op 0 allocs/op
Benchmark_GetMIME/fiber 14819698 78.3 ns/op 0 B/op 0 allocs/op
Benchmark_GetMIME/default 6459128 184 ns/op 0 B/op 0 allocs/op
Benchmark_GetMIME/default 6385042 184 ns/op 0 B/op 0 allocs/op
Benchmark_UUID/fiber 17652744 59.1 ns/op 48 B/op 1 allocs/op
Benchmark_UUID/fiber 19361145 58.5 ns/op 48 B/op 1 allocs/op
Benchmark_UUID/default 4271024 281 ns/op 64 B/op 2 allocs/op
Benchmark_UUID/default 4435306 278 ns/op 64 B/op 2 allocs/op
Benchmark_ToLower/fiber 22987184 48.2 ns/op 48 B/op 1 allocs/op
Benchmark_ToLower/fiber 24491794 49.6 ns/op 48 B/op 1 allocs/op
Benchmark_ToLower/default 9232608 123 ns/op 48 B/op 1 allocs/op
Benchmark_ToLower/default 9454870 123 ns/op 48 B/op 1 allocs/op
Benchmark_ToLowerBytes/fiber 44463876 26.1 ns/op 0 B/op 0 allocs/op
Benchmark_ToLowerBytes/fiber 39997200 26.1 ns/op 0 B/op 0 allocs/op
Benchmark_ToLowerBytes/default 14879088 77.6 ns/op 48 B/op 1 allocs/op
Benchmark_ToLowerBytes/default 14631433 79.2 ns/op 48 B/op 1 allocs/op
Benchmark_ToUpper/fiber 22648730 49.4 ns/op 48 B/op 1 allocs/op
Benchmark_ToUpper/fiber 23084425 48.6 ns/op 48 B/op 1 allocs/op
Benchmark_ToUpper/default 9520122 124 ns/op 48 B/op 1 allocs/op
Benchmark_ToUpper/default 9375014 133 ns/op 48 B/op 1 allocs/op
Benchmark_ToUpperBytes/fiber 44439176 25.6 ns/op 0 B/op 0 allocs/op
Benchmark_ToUpperBytes/fiber 44458934 25.5 ns/op 0 B/op 0 allocs/op
Benchmark_ToUpperBytes/default 15347073 74.1 ns/op 48 B/op 1 allocs/op
Benchmark_ToUpperBytes/default 15511370 74.2 ns/op 48 B/op 1 allocs/op
Benchmark_EqualFolds/fiber 34297864 33.8 ns/op 0 B/op 0 allocs/op
Benchmark_EqualFolds/fiber 34285322 34.0 ns/op 0 B/op 0 allocs/op
Benchmark_EqualFolds/default 12756945 91.8 ns/op 0 B/op 0 allocs/op
Benchmark_EqualFolds/default 13015282 91.1 ns/op 0 B/op 0 allocs/op
Benchmark_Trim/fiber 207314002 5.85 ns/op 0 B/op 0 allocs/op
Benchmark_Trim/fiber 207386125 5.78 ns/op 0 B/op 0 allocs/op
Benchmark_Trim/default 16506302 68.5 ns/op 32 B/op 1 allocs/op
Benchmark_Trim/default 16669119 68.9 ns/op 32 B/op 1 allocs/op
Benchmark_TrimLeft/fiber 343254828 3.47 ns/op 0 B/op 0 allocs/op
Benchmark_TrimLeft/fiber 344407171 3.45 ns/op 0 B/op 0 allocs/op
Benchmark_TrimLeft/default 24999790 46.4 ns/op 32 B/op 1 allocs/op
Benchmark_TrimLeft/default 25001926 45.3 ns/op 32 B/op 1 allocs/op
Benchmark_TrimRight/fiber 374543056 3.15 ns/op 0 B/op 0 allocs/op
Benchmark_TrimRight/fiber 336067616 3.15 ns/op 0 B/op 0 allocs/op
Benchmark_TrimRight/default 20868186 52.8 ns/op 32 B/op 1 allocs/op
Benchmark_TrimRight/default 21434695 55.1 ns/op 32 B/op 1 allocs/op
```

View File

@ -12,9 +12,9 @@ import (
func Test_Utils_FunctionName(t *testing.T) {
t.Parallel()
AssertEqual(t, "github.com/gofiber/fiber/v2/internal/utils.Test_Utils_UUID", FunctionName(Test_Utils_UUID))
AssertEqual(t, "github.com/gofiber/fiber/v2/utils.Test_Utils_UUID", FunctionName(Test_Utils_UUID))
AssertEqual(t, "github.com/gofiber/fiber/v2/internal/utils.Test_Utils_FunctionName.func1", FunctionName(func() {}))
AssertEqual(t, "github.com/gofiber/fiber/v2/utils.Test_Utils_FunctionName.func1", FunctionName(func() {}))
var dummyint = 20
AssertEqual(t, "int", FunctionName(dummyint))