Skip to content

Release 3.1.0

Compare
Choose a tag to compare
@batopa batopa released this 03 Jun 13:41
· 168 commits to master since this release
b787be0

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 as

    use 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 via GET /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.