slovocast/app/server/server.php

21 lines
455 B
PHP
Raw Normal View History

2024-06-20 02:20:42 +00:00
<?php
require_once '../vendor/autoload.php';
use Slovocast\Bootstrap;
use React\Http\HttpServer;
use React\Socket\SocketServer;
use Psr\Http\Message\ServerRequestInterface as Request;
$app = Bootstrap::init();
$http = new HttpServer(function (Request $request) use ($app) {
return $app->handle($request);
});
$address = "127.0.0.1:8000";
$socket = new SocketServer($address);
$http->listen($socket);
echo "Server running at $address" . PHP_EOL;