-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
42 additions
and
69 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
get "/p/:id", ctx => { | ||
ctx.yap "article", { | ||
"id": ctx.param("id"), | ||
} | ||
} | ||
get "/", ctx => { | ||
ctx.yap "home", {} | ||
} | ||
|
||
run ":8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,26 @@ | ||
package main | ||
|
||
import ( | ||
"embed" | ||
"io/fs" | ||
"github.com/goplus/yap" | ||
"github.com/qiniu/x/errors" | ||
) | ||
import "github.com/goplus/yap" | ||
|
||
type article struct { | ||
ID string | ||
type community_yap struct { | ||
yap.App | ||
} | ||
//go:embed yap | ||
var yapFS embed.FS | ||
//line cmd/gopcomm/community.gop:15 | ||
func main() { | ||
//line cmd/gopcomm/community.gop:15:1 | ||
fsYap := func() (_gop_ret fs.FS) { | ||
//line cmd/gopcomm/community.gop:15:1 | ||
var _gop_err error | ||
//line cmd/gopcomm/community.gop:15:1 | ||
_gop_ret, _gop_err = fs.Sub(yapFS, "yap") | ||
//line cmd/gopcomm/community.gop:15:1 | ||
if _gop_err != nil { | ||
//line cmd/gopcomm/community.gop:15:1 | ||
_gop_err = errors.NewFrame(_gop_err, "fs.sub(yapFS, \"yap\")", "cmd/gopcomm/community.gop", 15, "main.main") | ||
//line cmd/gopcomm/community.gop:15:1 | ||
panic(_gop_err) | ||
} | ||
//line cmd/gopcomm/community.gop:15:1 | ||
return | ||
}() | ||
//line cmd/gopcomm/community.gop:16:1 | ||
y := yap.New(fsYap) | ||
//line cmd/gopcomm/community.gop:18:1 | ||
y.GET("/p/:id", func(ctx *yap.Context) { | ||
//line cmd/gopcomm/community.gop:19:1 | ||
ctx.YAP(200, "article", article{ID: ctx.Param("id")}) | ||
//line cmd/gopcomm/community_yap.gox:1 | ||
func (this *community_yap) MainEntry() { | ||
//line cmd/gopcomm/community_yap.gox:1:1 | ||
this.Get("/p/:id", func(ctx *yap.Context) { | ||
//line cmd/gopcomm/community_yap.gox:2:1 | ||
ctx.Yap__1("article", map[string]string{"id": ctx.Param("id")}) | ||
}) | ||
//line cmd/gopcomm/community_yap.gox:6:1 | ||
this.Get("/", func(ctx *yap.Context) { | ||
//line cmd/gopcomm/community_yap.gox:7:1 | ||
ctx.Yap__1("home", map[string]interface { | ||
}{}) | ||
}) | ||
//line cmd/gopcomm/community.gop:24:1 | ||
y.Run(":8080") | ||
//line cmd/gopcomm/community_yap.gox:10:1 | ||
this.Run__1(":8080") | ||
} | ||
func main() { | ||
yap.Gopt_App_Main(new(community_yap)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
<meta charset="utf-8"/> | ||
</head> | ||
<body> | ||
Article {{.ID}} | ||
Article {{.id}} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8"/> | ||
</head> | ||
<body> | ||
Go+ Community <a href="/p/123">written in Go+</a> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
github.com/goplus/yap v0.3.0 h1:htp4eANRtBcaOAJuJNAVAtevQETJxKq4A+UV/v66fv0= | ||
github.com/goplus/yap v0.3.0/go.mod h1:VCbGlZo2lUgRWciTZwA5JEOuCUf8T2PhxZZ0HXqzgBk= | ||
github.com/qiniu/x v1.13.2 h1:mgWOfB9Rpk6AEtlBoObZVxH+b2FHSntYrxc4KX5Ta98= | ||
github.com/qiniu/x v1.13.2/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E= | ||
github.com/goplus/yap v0.5.0 h1:CU+QXeSNAcx72as7O2FC1NWCazKB7cf7dLyexmbf8y4= | ||
github.com/goplus/yap v0.5.0/go.mod h1:VCbGlZo2lUgRWciTZwA5JEOuCUf8T2PhxZZ0HXqzgBk= |