Skip to content

Commit

Permalink
Update routes.php so the example route uses config & logger
Browse files Browse the repository at this point in the history
  • Loading branch information
mlatzko committed Mar 10, 2016
1 parent 579de28 commit b790cb4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/bootstrap/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
* @copyright Copyright (c) 2015 Mathias Latzko
* @license https://opensource.org/licenses/MIT
*/
$config = $app->getContainer()->get('config');
$logger = $app->getContainer()->get('logger');

$app->get('/example', function($request, $response){
return $response->withJson(array('status' => 'ok', 'content' => array()), 200);
$app->get('/example', function($request, $response) use ($config, $logger){
$responseData = array('status' => 'ok', 'config' => $config->get('app'));

$logger->debug('Example executed.');

return $response->withJson($responseData, 200);
});

0 comments on commit b790cb4

Please sign in to comment.