# Use of ${id} in routing

**URL:** <https://discourse.slimframework.com/t/use-of-id-in-routing/6007>\
**Category:** Questions\
**Created:** [November 27, 2024, 7:39am UTC](https://discourse.slimframework.com/t/use-of-id-in-routing/6007 "2024-11-27T07:39:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bnoeafk](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bnoeafk](https://discourse.slimframework.com/u/bnoeafk)\
**Post date:** [November 27, 2024, 7:39am UTC](https://discourse.slimframework.com/t/use-of-id-in-routing/6007/1 "2024-11-27T07:39:06Z")

</div>

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.

```auto
//$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:

```auto
**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

---

<div class="post-metadata">

**Author:** ![bnoeafk](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bnoeafk](https://discourse.slimframework.com/u/bnoeafk)\
**Post date:** [November 27, 2024, 7:43am UTC](https://discourse.slimframework.com/t/use-of-id-in-routing/6007/2 "2024-11-27T07:43:05Z")

</div>

I don’t need the “$” do I?!

```auto
$app->get('/books/{id}', function ($r

```
