refactory: rebuild route tree
This commit is contained in:
@ -11,19 +11,17 @@ func main() {
|
||||
app.Get("/hello", func(c *nf.Ctx) error {
|
||||
return c.SendString("world")
|
||||
})
|
||||
app.Get("/panic", func(c *nf.Ctx) error {
|
||||
panic("panic")
|
||||
})
|
||||
|
||||
app.Use(ml())
|
||||
|
||||
log.Fatal(app.Run(":7777"))
|
||||
log.Fatal(app.Run(":80"))
|
||||
}
|
||||
|
||||
func ml() nf.HandlerFunc {
|
||||
return func(c *nf.Ctx) error {
|
||||
log.Printf("[ML] [%s] - [%s]", c.Method, c.Path())
|
||||
index := []byte(`<h1>my not found</h1>`)
|
||||
c.Set("Content-Type", "text/html")
|
||||
c.Status(403)
|
||||
_, err := c.Write(index)
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user