mirror of https://github.com/gofiber/fiber.git
Update middleware demo
parent
7041f051e1
commit
cc759981eb
13
README.md
13
README.md
|
@ -84,17 +84,16 @@ import "github.com/gofiber/fiber"
|
|||
func main() {
|
||||
app := fiber.New()
|
||||
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
c.Set("random-header", "random-value")
|
||||
c.Write("1st route!\n")
|
||||
app.Use(func(c *fiber.Ctx) {
|
||||
c.Write("Match anything!\n")
|
||||
c.Next()
|
||||
})
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
c.Write("2nd route!\n")
|
||||
app.Use("/api", func(c *fiber.Ctx) {
|
||||
c.Write("Match starting with /api\n")
|
||||
c.Next()
|
||||
})
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
c.Write("3rd route!\n")
|
||||
app.Get("/api/user", func(c *fiber.Ctx) {
|
||||
c.Write("Match exact path /api/user\n")
|
||||
})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue