Core
Framework v2.x
2

getString #

Available since 2.11.0

Gets a parameter from the request arguments and checks that it is a string.

Arguments #

Copied to clipboard!
getString (name: string, def: string = null): string

Name Type Description
name
string
Parameter name
def
string
Default value to return if the parameter is not set

Example #

Copied to clipboard!
const name = request.getString('name');
// equivalent
const name = request.input.args.name;
//+ checks to make sure that "name" is of the right type
// and throw standard API error when it's not the case