Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📚 Docs: Fix import and comma issues #2410

Merged
merged 1 commit into from Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/api/middleware/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ app.Use(cache.New(cache.Config{
Or you can custom key and expire time like this:

```go
app.Use(New(Config{
ExpirationGenerator: func(c *fiber.Ctx, cfg *Config) time.Duration {
app.Use(cache.New(cache.Config{
ExpirationGenerator: func(c *fiber.Ctx, cfg *cache.Config) time.Duration {
newCacheTime, _ := strconv.Atoi(c.GetRespHeader("Cache-Time", "600"))
return time.Second * time.Duration(newCacheTime)
},
KeyGenerator: func(c *fiber.Ctx) string {
return utils.CopyString(c.Path())
}
},
}))

app.Get("/", func(c *fiber.Ctx) error {
Expand Down
2 changes: 1 addition & 1 deletion docs/api/middleware/monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Import the middleware package that is part of the Fiber web framework
```go
import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/favicon"
"github.com/gofiber/fiber/v2/middleware/monitor"
)
```

Expand Down
2 changes: 1 addition & 1 deletion docs/api/middleware/proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ app.Get("/proxy", func(c *fiber.Ctx) error {

// Make proxy requests, timeout a minute from now
app.Get("/proxy", func(c *fiber.Ctx) error {
if err := DoDeadline(c, "http://localhost", time.Now().Add(time.Minute)); err != nil {
if err := proxy.DoDeadline(c, "http://localhost", time.Now().Add(time.Minute)); err != nil {
return err
}
// Remove Server header from response
Expand Down
2 changes: 1 addition & 1 deletion docs/api/middleware/skip.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
return ctx.SendString("It was a GET request!")
})

app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}

func BasicHandler(ctx *fiber.Ctx) error {
Expand Down
7 changes: 3 additions & 4 deletions docs/api/middleware/timeout.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ func main() {
}

app.Get("/foo/:sleepTime", timeout.New(h, 2*time.Second))

app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}

func sleepWithContext(ctx context.Context, d time.Duration) error {
Expand Down Expand Up @@ -103,7 +102,7 @@ func main() {
}

app.Get("/foo/:sleepTime", timeout.NewWithContext(h, 2*time.Second, ErrFooTimeOut))
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}

func sleepWithContextWithCustomError(ctx context.Context, d time.Duration) error {
Expand Down Expand Up @@ -142,6 +141,6 @@ func main() {
}

app.Get("/foo", timeout.NewWithContext(handler, 10*time.Second))
app.Listen(":3000")
log.Fatal(app.Listen(":3000"))
}
```