示例#1
0
文件: web.go 项目: robxu9/reservoir
func main() {
	goweb.MapFunc("/test/{func}/respond", func(c *goweb.Context) {
		fmt.Fprintf(c.ResponseWriter, "You called me with %s!", c.PathParams["func"])
	})

	goweb.ListenAndServe(":8080")
}
示例#2
0
文件: main.go 项目: rails0330/goweb
func main() {

	handler := func(c *goweb.Context) {
		name := c.PathParams["name"]
		animal := c.PathParams["animal"]
		fmt.Fprintf(c.ResponseWriter, "Hey %s, your favorite animal is a %s", name, animal)
	}

	goweb.MapFunc("/people/{name}/animals/{animal}", handler)
	goweb.ListenAndServe(":8080")
}