Skip to content

Commit

Permalink
📚 Docs: Fix import and comma issues (#2410)
Browse files Browse the repository at this point in the history
Fix import and comma issues
  • Loading branch information
cmd777 authored Apr 13, 2023
1 parent 866d5b7 commit 3b7a7d4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
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"))
}
```

0 comments on commit 3b7a7d4

Please sign in to comment.