New here - new to Slim, so please be gentle!
I’m going through the documentation and so far, all is good. However, whenever I try to use an “id” in a route, I always seem to get a HTTP/404 error.
//$app->addRoutingMiddleware();
$app->get('/books/${id}', function ($request, $response, array $args) {
$response->getBody()->write("This would be book ID: " . $args['id']);
return $response;
});
As you can see, I’ve tried using the addRoutingMiddleware, but that doesn’t seem to make any difference.
My error page looks like:
**Type:** Slim\Exception\HttpNotFoundException
**Code:** 404
**Message:** Not found.
**File:** /var/www/secure/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php
**Line:** 76
Can someone please give me a little clue as to what I’m doing wrong? I was hoping to make a call to something like /books/123 and the response showing a basic “This would be book ID: 123” but I’m not getting anywhere near that!!
Thanks in advance.
bnoeafk