Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static file example #24

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
static file example
xushiwei committed Jan 19, 2024
commit f94c7736a1bd4c279a3d3762cfdb1476cbe4e8d8
4 changes: 3 additions & 1 deletion demo/classfile_static/gop_autogen.go
Original file line number Diff line number Diff line change
@@ -8,8 +8,10 @@ type staticfile struct {
//line demo/classfile_static/staticfile_yap.gox:1
func (this *staticfile) MainEntry() {
//line demo/classfile_static/staticfile_yap.gox:1:1
this.Static("/foo", this.FS("public"))
//line demo/classfile_static/staticfile_yap.gox:2:1
this.Static("/")
//line demo/classfile_static/staticfile_yap.gox:3:1
//line demo/classfile_static/staticfile_yap.gox:4:1
this.Run(":8888")
}
func main() {
1 change: 1 addition & 0 deletions demo/classfile_static/staticfile_yap.gox
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
static "/foo", FS("public")
static "/"

run ":8888"
8 changes: 8 additions & 0 deletions demo/classfile_static/yap/public/a.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<a href="b.txt">b.txt</a>
</body>
</html>
1 change: 1 addition & 0 deletions demo/classfile_static/yap/public/b.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Content b.txt
1 change: 1 addition & 0 deletions demo/classfile_static/yap/static/index.html
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
<body>
<ul>
<li><a href="hello.txt">hello.txt</a></li>
<li><a href="/foo">/foo</a></li>
</ul>
</body>
</html>