Skip to content

Route Expression for list with pattern? #23

@gracedigital

Description

@gracedigital

Anyone know if its possible to combine these 2 type of route expressions?

The Slim3 documentation gives this example:
$app = new \Slim\App();
$app->any('/books/[{id}]', function ($request, $response, $args) {
// Apply changes to books or book identified by $args['id'] if specified.
// To check which method is used: $request->getMethod();
});

Is the regex format "[{id}]" just semantical? Do the outer brackets actually do anything to parse the values?

What is the best practice for accepting one or more ids of a specific format?

I tried using this pattern but it does not work...
/books/{[id:[0-9]+]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions