gosh/example/main.go

22 lines
361 B
Go

package main
import (
"fmt"
"net/http"
"git.kingecg.top/kingecg/gosh"
)
func main() {
serverMux := gosh.NewSHMux()
serverMux.RegistFunction("hello", func(name string) string {
return fmt.Sprintf("Hello, %s", name)
})
serverMux.GET("/hello", `
name = Req.GetQuery("name")
Res.WriteStr(hello(name))
`)
http.ListenAndServe(":8089", serverMux)
}