diff --git a/demo/blog/blog.go b/demo/blog/blog.go index b56f142..5a89219 100644 --- a/demo/blog/blog.go +++ b/demo/blog/blog.go @@ -9,6 +9,9 @@ import ( func main() { y := yap.New(os.DirFS(".")) + y.GET("/", func(ctx *yap.Context) { + ctx.TEXT(200, "text/html", `Hello, YAP!`) + }) y.GET("/p/:id", func(ctx *yap.Context) { ctx.YAP(200, "article", yap.H{ "id": ctx.Param("id"), diff --git a/demo/blog/yap/article_yap.html b/demo/blog/yap/article_yap.html index 7985956..8cf77a6 100644 --- a/demo/blog/yap/article_yap.html +++ b/demo/blog/yap/article_yap.html @@ -1,8 +1,4 @@ - - - - -Article {{.id}} - - + +Article {{.id}} + \ No newline at end of file diff --git a/demo/blog_emb/blog.go b/demo/blog_emb/blog.go index d58c762..c4cb0c0 100644 --- a/demo/blog_emb/blog.go +++ b/demo/blog_emb/blog.go @@ -18,6 +18,9 @@ func main() { fsYap, _ := fs.Sub(yapFS, "yap") y := yap.New(fsYap) + y.GET("/", func(ctx *yap.Context) { + ctx.TEXT(200, "text/html", `Hello, YAP!`) + }) y.GET("/p/:id", func(ctx *yap.Context) { ctx.YAP(200, "article", article{ ID: ctx.Param("id"), diff --git a/demo/blog_emb/yap/article_yap.html b/demo/blog_emb/yap/article_yap.html index 6b0bd8f..1edd345 100644 --- a/demo/blog_emb/yap/article_yap.html +++ b/demo/blog_emb/yap/article_yap.html @@ -1,8 +1,4 @@ - - - - -Article {{.ID}} - + +Article {{.ID}} diff --git a/demo/hello/hello.go b/demo/hello/hello.go index 0e9176b..34bf77f 100644 --- a/demo/hello/hello.go +++ b/demo/hello/hello.go @@ -6,13 +6,13 @@ import ( func main() { y := yap.New() + y.GET("/", func(ctx *yap.Context) { + ctx.TEXT(200, "text/html", `Hello, YAP!`) + }) y.GET("/p/:id", func(ctx *yap.Context) { ctx.JSON(200, yap.H{ "id": ctx.Param("id"), }) }) - y.Handle("/", func(ctx *yap.Context) { - ctx.TEXT(200, "text/html", `Hello, YAP!`) - }) y.Run(":8080") }