mirror of https://github.com/gofiber/fiber.git
📚 Doc: Update intro.md Static Files section (#3303)
Update intro.md Static Files section In v3 the apps Static method has been removed and its functionality has been moved to the static middleware. The given code example has been updated accordingly.pull/3305/head
parent
7af9c93f5b
commit
6148c6fe29
|
@ -163,7 +163,7 @@ app.Get("/api/*", func(c fiber.Ctx) error {
|
|||
|
||||
### Static Files
|
||||
|
||||
To serve static files such as **images**, **CSS**, and **JavaScript** files, use the `Static` method with a directory path. For more information, refer to the [static middleware](./middleware/static.md).
|
||||
To serve static files such as **images**, **CSS**, and **JavaScript** files, use the [static middleware](./middleware/static.md).
|
||||
|
||||
Use the following code to serve files in a directory named `./public`:
|
||||
|
||||
|
@ -172,12 +172,13 @@ package main
|
|||
|
||||
import (
|
||||
"github.com/gofiber/fiber/v3"
|
||||
"github.com/gofiber/fiber/v3/middleware/static"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := fiber.New()
|
||||
|
||||
app.Static("/", "./public")
|
||||
app.Use("/", static.New("./public"))
|
||||
|
||||
app.Listen(":3000")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue