mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-24 20:24:29 +00:00
Update README.md
This commit is contained in:
parent
a40a2ba659
commit
b6958e8ebb
18
README.md
18
README.md
@ -34,8 +34,8 @@ import "github.com/gofiber/fiber"
|
||||
|
||||
func main() {
|
||||
app := fiber.New()
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
c.Send("Hello, World!")
|
||||
app.Get("/:name", func(c *fiber.Ctx) {
|
||||
c.Send("Hello, " + c.Params("name") + !")
|
||||
})
|
||||
app.Listen(8080)
|
||||
}
|
||||
@ -54,16 +54,20 @@ import "github.com/gofiber/fiber"
|
||||
|
||||
func main() {
|
||||
app := fiber.New()
|
||||
app.Static("./public")
|
||||
app.Get("/static", func(c *fiber.Ctx) {
|
||||
c.Set("X-XSS-Protection", "1; mode=block")
|
||||
c.Next()
|
||||
})
|
||||
app.Static("/static", ./public")
|
||||
app.Listen(8080)
|
||||
}
|
||||
```
|
||||
Now, you can load the files that are in the public directory:
|
||||
```shell
|
||||
http://localhost:8080/images/gopher.png
|
||||
http://localhost:8080/css/style.css
|
||||
http://localhost:8080/js/jquery.js
|
||||
http://localhost:8080/hello.html
|
||||
http://localhost:8080/static/images/gopher.png
|
||||
http://localhost:8080/static/css/style.css
|
||||
http://localhost:8080/static/js/jquery.js
|
||||
http://localhost:8080/static/hello.html
|
||||
```
|
||||
|
||||
## API Documentation
|
||||
|
Loading…
x
Reference in New Issue
Block a user