github.com/goplus/yap@v0.8.1/demo/blog_nestetemplate/blog.go (about) 1 package main 2 3 import ( 4 "os" 5 6 "github.com/goplus/yap" 7 ) 8 9 func main() { 10 y := yap.New(os.DirFS(".")) 11 12 y.GET("/", func(ctx *yap.Context) { 13 ctx.TEXT(200, "text/html", `<html><body>Hello, <a href="/p/123">YAP</a>!</body></html>`) 14 }) 15 y.GET("/p/:id", func(ctx *yap.Context) { 16 ctx.YAP(200, "blog", yap.H{ 17 "Id": ctx.Param("id"), 18 }) 19 }) 20 y.Run(":8888") 21 }