Just like in a custom router, either by name of a function or via an anonymous function:
c:set( 'routes', array(
array(
'pattern' => 'archive/(:num)/mail',
'method' => 'ALL',
'filter' => function($route) {
// some checks
// $route is the route array
},
'action' => function( $no ) {
if ( $issue = page( 'archive/' . $no ) ) {
return new Response(
snippet( 'copyMail', array( 'issue' => $issue ), true )
);
}
}
),
) );