Changed way to connect to api

This commit is contained in:
2022-11-30 10:40:36 -03:00
parent f8500e061c
commit a5d97729dc
12 changed files with 129 additions and 43 deletions

View File

@ -0,0 +1,17 @@
<?php
namespace ProVM\Common\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use ProVM\Common\Service\Api as Service;
class Api
{
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, Service $service): ResponseInterface
{
$body = $request->getBody();
$json = \Safe\json_decode($body->getContents(), JSON_OBJECT_AS_ARRAY);
return $service->sendRequest($json);
}
}