+
This commit is contained in:
41
xbotcontrol.php
Normal file
41
xbotcontrol.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
||||
$dotenv->load();
|
||||
$_ENV['APP_DIR'] = __DIR__;
|
||||
$_ENV['X_LISTEN'] = '0.0.0.0:7500';
|
||||
|
||||
|
||||
|
||||
XBotControl\InitTables::create();
|
||||
$app = new FrameworkX\App();
|
||||
|
||||
$app->get(
|
||||
'/mirror',
|
||||
function (Psr\Http\Message\ServerRequestInterface $request) {
|
||||
return XBotControl\Request::save($request);
|
||||
}
|
||||
);
|
||||
|
||||
$app->get('/mirror1', function () {
|
||||
return React\Http\Message\Response::plaintext(
|
||||
"Hello wörld!\n"
|
||||
);
|
||||
});
|
||||
|
||||
$app->get('/cp', function (Psr\Http\Message\ServerRequestInterface $request) {
|
||||
return React\Http\Message\Response::plaintext(
|
||||
"Hello " . $request->getAttribute('name') . "!\n"
|
||||
);
|
||||
});
|
||||
|
||||
$app->run();
|
||||
|
||||
XBotControl\Storage::getInstance()->db->query('PRAGMA main.wal_checkpoint;')
|
||||
->then(function () {
|
||||
XBotControl\Storage::getInstance()->db->quit();
|
||||
});
|
||||
Reference in New Issue
Block a user