diff --git a/geg/net/ghttp/server/template/tpl.go b/geg/net/ghttp/server/template/tpl.go deleted file mode 100644 index 87be74714..000000000 --- a/geg/net/ghttp/server/template/tpl.go +++ /dev/null @@ -1,16 +0,0 @@ -package main - -import ( - "gitee.com/johng/gf/g" - "gitee.com/johng/gf/g/net/ghttp" -) - -func main() { - s := g.Server() - s.BindHandler("/", func(r *ghttp.Request){ - content :=`{{if (get "name")}} {{get "name"}} {{else}} NoName {{end}}` - r.Response.WriteTplContent(content, nil) - }) - s.SetPort(8199) - s.Run() -} \ No newline at end of file diff --git a/geg/net/ghttp/server/template/tpl1/index.html b/geg/net/ghttp/server/template/tpl1/index.html new file mode 100644 index 000000000..8a50061ce --- /dev/null +++ b/geg/net/ghttp/server/template/tpl1/index.html @@ -0,0 +1,11 @@ + + + + + {{.title}} + + +

姓名 : {{.name}}

+12311 + + \ No newline at end of file diff --git a/geg/net/ghttp/server/template/tpl1/tpl1.go b/geg/net/ghttp/server/template/tpl1/tpl1.go new file mode 100644 index 000000000..f47bef17d --- /dev/null +++ b/geg/net/ghttp/server/template/tpl1/tpl1.go @@ -0,0 +1,23 @@ +package main + +import ( + "gitee.com/johng/gf/g/frame/gmvc" + "gitee.com/johng/gf/g/net/ghttp" +) +type ControllerIndex struct { + gmvc.Controller +} +func (c *ControllerIndex) Info() { + c.View.Assign("title", "Go Frame 第一个网站") + c.View.Assigns(map[string]interface{}{ + "name" : "很开心1", + "score" : 100, + }) + c.View.Display("index.html") +} +func main() { + s := ghttp.GetServer() + s.BindController("/", new(ControllerIndex)) + s.SetPort(8199) + s.Run() +} diff --git a/geg/other/test.go b/geg/other/test.go index 16c5cabe5..f080414e3 100644 --- a/geg/other/test.go +++ b/geg/other/test.go @@ -1,5 +1,7 @@ package main +import "fmt" + func main() { - <- make(chan struct{}) + fmt.Print(1) } \ No newline at end of file