A dish on demand

Exercise 2 of 6 in chapter 5 · 220 XP · 5 objectives checked by tests

Topics covered: #[Groups] on a method#[Context]format: 'json'Problem JSON

The adventurers love having the menu on their scroll. Now they want to know what others think of a dish before ordering it (Gimli swears by it).

Your mission

Add GET /api/dishes/{slug}: a dish's page, which repeats the menu details and adds:

The menu (GET /api/dishes) must stay light: no reviews and no average rating.

{
    "slug": "dwarf-stew",
    "nom": "Grumpy Dwarf Stew",
    "prix": 12.5,
    "…": "…",
    "avis": [
        { "auteur": "Legolas", "note": 2, "message": "A bit heavy for an elf.", "creeLe": "2026-09-11" }
    ],
    "noteMoyenne": 3.5
}

Finally, an unknown dish must give a 404 in JSON. Try /api/dishes/grilled-unicorn in the preview: it's an HTML page! A scroll wouldn't understand a word of it.

Good to know