nf/xtest/midd/main.go

25 lines
351 B
Go
Raw Permalink Normal View History

2024-02-19 16:00:56 +08:00
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()
}
}