<https://coldbox.ortusbooks.com/the-basics/routing...
# box-products
s
i went with documentation before i asked and that is still not clear
i do not get why cf community is so reluctant to answer if someone knows how they can do
p
The answer is right there in that document, what is not clear?
Copy code
route( 
    pattern = "/users/list", 
    target = "users.index", 
    name = "usermanager" 
);
the "pattern" is what your url would have aka
/api/getusersinfo/:id
the "target" is the function with your cfc aka
api.getuserinfo
No one is reluctant, you are just misunderstanding the advice.
s
Something is quite wrong, This is what i did
Copy code
route(
            pattern="/api/getusersinfo/:id",
            target="Api.getusersinfo"
        );
my function is like this in Api.cfc
Copy code
function getusersinfo(event, rc, prc, id) {
73:         local.x= service.data(id);
74:         return local.x;
75:     }
i get an error variable [ID] doesn't exist
p
you need to reference it from the scope it resides in; thus needs to be
rc.id
all url, form data is put into the RC scope; I think you need to take the 60 minute crash course on how the framework works: https://coldbox.ortusbooks.com/for-newbies/60-minute-quick-start
✔️ 1
s
that makes sense, Thanks