golanglearn/web/framework/framework-context/main.go
2022-02-13 11:46:56 +08:00

27 lines
543 B
Go

package main
import (
"golanglearn/web/framework/framework-context/gee"
)
func main() {
engine := gee.New()
engine.GET("/", func(c *gee.Context) {
c.HTML(200, "<h1>hello</h1>")
})
engine.GET("/hello", func(c *gee.Context) {
c.String(200, "hello,%v", c.Query("name"))
})
engine.POST("/login", func(c *gee.Context) {
//c.JSON(200, gee.H{
// "username": "xxxx",
// "password": "1234",
//})
c.JSON(200, gee.H{
"username": c.PostForm("username"),
"password": c.PostForm("password"),
})
})
_ = engine.Run(":9000")
}