diff --git a/main.go b/main.go index a67b1a2..b9146ad 100644 --- a/main.go +++ b/main.go @@ -48,7 +48,7 @@ type http_status_code int; const ( type empty_request_body struct {} /* T Representing any request body struct S Representing any response body struct */ -func http_new_route[T any, S any](method http_method, route string, handle_func func(body T, raw_request *http.Request) (S, http_status_code)) { +func json_new_route[T any, S any](method http_method, route string, handle_func func(body T, raw_request *http.Request) (S, http_status_code)) { http.HandleFunc(method.to_string() + " /" + route, func(response http.ResponseWriter, request *http.Request) { request_body_bytes, err := io.ReadAll(request.Body) if err != nil { @@ -99,7 +99,7 @@ func main() { Field2: body.Arg1 + body.Arg2, }, OK } - http_new_route(GET, "foo", foo_route_handler) + json_new_route(GET, "foo", foo_route_handler) type bar_response_body struct { Response int @@ -111,7 +111,7 @@ func main() { Message: "hi there on bar!", }, INTERNAL_SERVER_ERROR } - http_new_route(GET, "bar", bar_route_handler) + json_new_route(GET, "bar", bar_route_handler) http_server := &http.Server{ Addr: ":8080",