lithium\net\http\Route::$_handler

protected property

Contains a function which will be executed if this route is matched. The function takes the instance of the associated Request object, and the array of matched route parameters, and must return either the parameters array (which may be modified by the handler) or a Response object, in which case the response will be returned directly. This may be used to handle redirects, or simple API services.

new Route([
    'template' => '/photos/{:id:[0-9]+}.jpg',
    'handler' => function($request) {
        return new Response([
            'headers' => ['Content-type' => 'image/jpeg'],
            'body' => Photos::first($request->id)->bytes()
        ]);
    }
}];

Source

	protected $_handler = null;