Release 3.1.0
Main changes are:
-
introduction of
ApiProxyTrait
to easily proxy requests to BEdita4 API in a controller. Only GET request are supported for now.
To enable it create a controller asuse BEdita\WebTools\Controller\ApiProxyTrait; use App\Controller\AppController; class ApiController extends AppController { use ApiProxyTrait; }
and define the routing rule
$routes->scope('/api', ['_namePrefix' => 'api:'], function (RouteBuilder $routes) { $routes->get('/**', ['controller' => 'Api', 'action' => 'get'], 'get'); });
Then you can do requests to
/api/*
route (for example viaGET /api/users
) obtaining the raw json response from the API. In the response the URL of the API will be masked with the app URL.