feat: add getTask for fetching single task

This commit is contained in:
2025-04-14 00:05:48 +01:00
parent 0ff8ffdb05
commit 66ba2473af
2 changed files with 29 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ use Controllers\TaskController;
use DI\Bridge\Slim\Bridge;
use DI\Container;
use Controllers\HomeFrontController;
use Slim\Handlers\Strategies\RequestResponseArgs;
require_once __DIR__ . '/vendor/autoload.php';
@@ -11,9 +12,15 @@ $container = new Container();
$app = Bridge::create($container);
$app->addBodyParsingMiddleware();
// this strategy is preferable because we aren't using a lot of named placeholders
$routeCollector = $app->getRouteCollector();
$routeCollector->setDefaultInvocationStrategy(new RequestResponseArgs());
$app->get('/', [HomeFrontController::class, 'home']);
$app->get('/tasks', [TaskController::class, 'getTasks']);
$app->get('/tasks/{id}', [TaskController::class, 'getTask']);
$app->post('/tasks', [TaskController::class, 'addTask']);