Closed helhum closed 2 years ago
I have created a TypoScriptRenderingMiddleware in bnf/typo3-middleware which can be used with my Slim Framework integration bnf/slim-typo3.
Slim uses nikic/fastroute
and provides a small, and userfriendly interface, including middlewares – in my opinion a perfect fit for what this issue wants, and better than implementing an own router.
Usage is quite easy. Define the route using slim, then implicitly dispatch to typoscrpt-rendering using the middleware:
composer require bnf/typo3-middleware:~0.1.1 bnf/slim-typo3:~0.2.1 helhum/typoscript-rendering:^2.0
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Bnf\SlimTypo3\AppRegistry::class)
->push(function($app) {
/* Simple Example, no (content element) context, only call extbase plugin */
$app->get('/some-extbase-api', function ($request, $response) {
$handler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Bnf\Typo3Middleware\TypoScriptRenderingMiddleware::class, [
'signature' => 'extensionname_pluginname',
]);
return $handler->process($request);
});
Closing this here as it is out of scope for now
Instead of having a GET argument with a json encoded value, it might be nice to resolve to a controller/action/context with a router (similar to https://github.com/xperseguers/t3ext-routing but resolving typoscript_rendering hook instead)