Validate the query string in an action
Like input for the body and params for the path, query describes the query string. The framework validates it and converts the values (the page number below arrives as a real number); an invalid query answers with a validation error before your code runs.
NEWACTION('Search/exec', {
name: 'Search',
query: 'q:String, page:Number, *sort:Lowercase',
action: function($) {
$.callback({ q: $.query.q || '', page: $.query.page || 1, sort: $.query.sort });
}
});exports.install = function() {
ROUTE('GET /search/ --> *Search/exec');
};