package routes import ( "net/http" "timefu.li/backend/tubson" ) func register_user_routes(endpoint string) { type foo_request_body struct { Arg1 int Arg2 int } type foo_response_body struct { Field1 string Field2 int } foo_endpoint_handler := func(body foo_request_body, raw_request *http.Request) (foo_response_body, tubson.Http_status_code) { return foo_response_body { Field1: "hi there on foo!", Field2: body.Arg1 + body.Arg2, }, tubson.OK } tubson.New_endpoint(tubson.GET, endpoint, "foo", foo_endpoint_handler) type bar_response_body struct { Response int Message string } bar_endpoint_handler := func(body tubson.Empty_request_body, raw_request *http.Request) (bar_response_body, tubson.Http_status_code) { return bar_response_body { Response: 400, Message: "hi there on bar!", }, tubson.INTERNAL_SERVER_ERROR } tubson.New_endpoint(tubson.GET, endpoint, "bar", bar_endpoint_handler) }