Files
api/resources/routes/auth.php
2021-11-30 18:04:41 -03:00

13 lines
460 B
PHP

<?php
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Incoviba\API\Common\Service\Auth as Service;
$app->get('/auth/generate', function(Request $request, Response $response, Service $service): Response {
$key = $service->generate();
$response->getBody()->write(json_encode(['key' => $key]));
return $response
->withStatus(200)
->withHeader('content-type', 'application/json');
});