This commit is contained in:
2025-04-25 20:59:13 -04:00
parent e84c7cf9ad
commit 60b758e995
14 changed files with 795 additions and 34 deletions

View File

@@ -40,4 +40,4 @@ class Config extends Facade
{
return 'config';
}
}
}

View File

@@ -22,7 +22,6 @@ use Spiral\Goridge\RPC\RPC;
*/
class Logger extends Facade
{
public static function getFacadeRoot(): RRLogger
{
$rpc = RPC::create('tcp://127.0.0.1:6001');
@@ -39,4 +38,4 @@ class Logger extends Facade
{
return RRLogger::class;
}
}
}

View File

@@ -13,7 +13,6 @@ use Nyholm\Psr7\Response;
*/
class JsonResponseFactory
{
/**
* Create a JSON response with the given data and status code.
*
@@ -32,4 +31,4 @@ class JsonResponseFactory
body: json_encode($data, JSON_THROW_ON_ERROR)
);
}
}
}

View File

@@ -31,10 +31,12 @@ class CorsMiddleware implements MiddlewareInterface
{
$origin = $request->getHeaderLine('Origin');
$allowedOrigins = array_map(
'trim', explode(
',',
Config::get('CORS_ALLOWED_ORIGINS', 'https://example.com,https://another.com')
));
'trim',
explode(
',',
Config::get('CORS_ALLOWED_ORIGINS', 'https://example.com,https://another.com')
)
);
$allowOrigin = in_array($origin, $allowedOrigins, true)
? $origin
@@ -63,4 +65,4 @@ class CorsMiddleware implements MiddlewareInterface
return $response->withHeader('Access-Control-Max-Age', $maxAge);
}
}
}

View File

@@ -8,5 +8,4 @@ use Illuminate\Database\Eloquent\Model as ORM;
abstract class Model extends ORM
{
}
}

View File

@@ -25,7 +25,6 @@ use Spiral\RoadRunner\Worker;
*/
class Server
{
/**
* @var Router The router instance for handling routes.
*/
@@ -142,7 +141,7 @@ class Server
$response = $this->router->handle($request);
$this->worker->respond($response);
} catch (MethodNotAllowedException|NotFoundException) {
} catch (MethodNotAllowedException | NotFoundException) {
$this->worker->respond(
JsonResponseFactory::createJsonResponse(
['status_code' => 404, 'reason_phrase' => 'Not Found'],
@@ -167,4 +166,4 @@ class Server
}
}
}
}
}