Description
hello,
I've severall custom controllers ; each function/route create the Response return by api->handle and send as Response to the call.
I'd like to make post operations (after the response has been send) that can be time consuming like reindexing DB or making backup (few seconds) and I don't want to block the response..
Of course, I could add this function to the last line of the my api.php
`<?php
namespace Tqdev\PhpCrudApi;
use Tqdev\PhpCrudApi\Api;
use Tqdev\PhpCrudApi\Config\Config;
use Tqdev\PhpCrudApi\RequestFactory;
use Tqdev\PhpCrudApi\ResponseUtils;
require 'api.include.php';
require 'eCtrl.php';
require_once 'eConf.php';
$config = new Config([
'driver' => CONF_driver,
'address' => CONF_address,
'port' => CONF_port,
'database' => CONF_database,
'username' => CONF_username,
'password' => CONF_password,
'cachePath' => CONF_tempDir,
'cacheType'=>'TempFile',
'controllers'=>'cache', //"records,status', // for /status/ping
//'middlewares'=>'', // cors disabled xsrf don't work with cors disabled ?
'middlewares'=>'cors', // for dev only
'customControllers' => 'eCtrl',
]);
$request = RequestFactory::fromGlobals();
$api = new Api($config);
$response = $api->handle($request);
ResponseUtils::output($response);
file_put_contents('request.log',RequestUtils::toString($request)."===\n",FILE_APPEND);
file_put_contents('request.log',ResponseUtils::toString($response)."===\n",FILE_APPEND);
`
but in this case, how to call in this case a function of eCtrl class (not a static one?)