25 lines
878 B
PHP
25 lines
878 B
PHP
<?php
|
|
|
|
use Psr\Http\Message\ResponseInterface as Response;
|
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
|
use DI\Bridge\Slim\Bridge;
|
|
use App\View\ViewController;
|
|
use App\Text\TextController;
|
|
use App\Node\NodeController;
|
|
|
|
$container = require __DIR__.'/container.php';
|
|
$app = Bridge::create($container);
|
|
|
|
// change first param to false for production
|
|
$app->addErrorMiddleware(true, true, true);
|
|
|
|
$app->get('/admin', [ViewController::class, 'admin']);
|
|
$app->get('/admin/texts', [ViewController::class, 'texts']);
|
|
$app->get('/admin/texts/{textId}', [ViewController::class, 'text']);
|
|
|
|
$app->get('/api/texts', [TextController::class, 'getTexts']);
|
|
$app->get('/api/texts/{textId}', [TextController::class, 'getText']);
|
|
$app->get('/api/texts/{textId}/nodes', [NodeController::class, 'getNodes']);
|
|
$app->post('/api/texts', [TextController::class, 'createText']);
|
|
|
|
return $app;
|