I am trying to get this custom route working. The code goes like this:
add_action( \'rest_api_init\', function () { register_rest_route( \'my-namespace/\', \'