Last active
November 9, 2015 17:10
-
-
Save hello-josh/29617a38ce39456ecbbc to your computer and use it in GitHub Desktop.
Functional replacement for App\Action\IndexAction from http://www.sitepoint.com/build-nasa-photo-gallery-zend-expressive/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function index_action(TemplateRendererInterface $templateRenderer) { | |
return function (ServerRequestInterface $request, | |
ResponseInterface $response, | |
callable $next = null) use ($templateRenderer) { | |
$html = templateRenderer->render('app::index'); | |
$response->getBody()->write($html); | |
return $response->withHeader('Content-Type', 'text/html'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment