fix: root middleware not work

This commit is contained in:
loveuer
2024-02-19 16:00:56 +08:00
parent 1c9c21e294
commit de3ce47671
3 changed files with 26 additions and 2 deletions

24
xtest/midd/main.go Normal file
View File

@ -0,0 +1,24 @@
package main
import (
"github.com/loveuer/nf"
"log"
)
func main() {
app := nf.New()
app.Use(ml())
app.Get("/hello", func(c *nf.Ctx) error {
return c.SendString("world")
})
log.Fatal(app.Run(":7777"))
}
func ml() nf.HandlerFunc {
return func(c *nf.Ctx) error {
log.Printf("[ML] [%s] - [%s]", c.Method, c.Path())
return c.Next()
}
}