fix: root middleware not work
This commit is contained in:
1 parent
1c9c21e294
commit
de3ce47671
3 files changed
+26
-2
No files matched your search
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user