I’ve been searching the docs for this but either I can’t find it or don’t understand how to implement it.
I have the following that retrieves a record using an ID:
$app->get('/api/user/{id}, function ($request, $response, $args) {
$id = $args['id'];
echo $id;
});
and also wanted to retrieve a record using a username, i.e.
$app->get('/api/user/{username}, function ($request, $response, $args) {
$username = $args['username'];
echo $username;
});
but adding those two, gives me an error unless I replace the user route with ‘/api/user/test/{username}’.
I would like to use the ‘/api/user/’ path so what would be the correct code for this?
EDIT: NVM, Found out about $app->group()