Skip to content

Commit c7fa7b3

Browse files
committed
Add new route to retreive user by ID
1 parent 224171e commit c7fa7b3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

app/routes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
declare(strict_types=1);
44

55
use App\Action\User\UserCreateAction;
6+
use App\Action\User\UserReadAction;
67
use Slim\App;
78

89
return function (App $app) {
910
$app->get('/', \App\Action\HomeAction::class)->setName('home');
1011
$app->post('/users', UserCreateAction::class);
12+
$app->get('/users/{id}', UserReadAction::class);
1113
};

src/Action/HomeAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ public function __invoke(
1919

2020
return $response
2121
->withHeader('Content-Type', 'application/json')
22-
->withStatus(StatusCode::CREATED);
22+
->withStatus(StatusCode::OK);
2323
}
2424
}

0 commit comments

Comments
 (0)