Function Arguments
Arguments in a function interact with the @param system. To understand how to use them, read the documentation on @param.
Warning
Cookie arguments aren't able to be tested in /docs. This is because
setting cookies in requests is considered a security risk by most browsers,
and so they don't allow it.
I reccomend doing one of the following:
Avaliable arguments
Tip
If using the body argument, the only type avaliable is object.
It's also reccomended to specify a contentType.
Path example:
Example
Query, header & cookie example:
Example
/**
* Gets all users with a certain age
* @param user The name of the user
* @returns all users with a certain age
*/
function getAge(age: number): string[] {
`
Gets all users with a certain age
@param where:query type:number name:age | The age to search for
`;
return ["john", "jane"]
}
router.get("/user", getAge);
// /user?age=20 -> ["john", "jane"]
// header Age: 30
// /user -> ["joe", "alex"]
// cookie Age: 40
// /user -> ["anthony", "margret"]