func ExampleServeMux_ServeHTTP() { mux.Handles(rest.Paths{ "/user/:id": { "GET": func(c *rest.Context) error { return c.Send(rest.JSON{ "user": c.Param("id"), "date": time.Now().UTC(), }) }, "POST": rest.Data("OK", "text/plain"), }, "/favicon.ico": { "GET": rest.File("./favicon.ico"), }, }) http.ListenAndServe(":8080", mux) }
func ExampleData() { mux.Handle("GET", "/static/", rest.Data("OK", "")) mux.Handle("GET", "/bin/", rest.Data([]byte{0x1, 0x2, 0x3, 0x4}, "application/octet-stream")) }