1
0
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:
Fenny 2020-01-16 10:13:23 +01:00 committed by GitHub
parent a40a2ba659
commit b6958e8ebb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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