Beispiel #1
0
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")
}
Beispiel #2
0
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")
}