package main import ( "errors" "fmt" "log" "nf" "time" ) func main() { app := nf.New() app.Get("/hello", func(c *nf.Ctx) error { return c.SendString("world") }) app.Get("/world", func(c *nf.Ctx) error { return errors.New("nice") }) v1 := app.Group("/v1") v1.Get("/hello", func(c *nf.Ctx) error { return c.JSON(nf.Map{"version": "v1", "date": time.Now()}) }) v1.Get( "/name", func(c *nf.Ctx) error { c.Params["name"] = "zyp" return c.Next() }, func(c *nf.Ctx) error { return c.SendString(fmt.Sprintf("hi, %s", c.Params["name"])) }, ) log.Fatal(app.Run(":7733")) }