Chapter 2 of the Discover Goravel track

The round

Structs and slices for the deliveries, the query string, HTTP status codes, the request body and validation.

4 exercises · 400 XP · about 1 h 30 min

This chapter works on: StructJSON tagQuery stringfor rangeappendRoute parameterHTTP status code404Request bodyPOST201Validation422Error handling

The chapter's exercises

  1. Today's round

    Exercise 1 · 100 XP · 3 objectives checked by tests

    On to the deliveries. Margot's nephew wrote LivraisonController (livraison means “delivery”): a Livraison struct, today's round in memory, and a GET /deliveries route that sends all of it back. But a courier only rides in their own neighborhood, and the app would like to receive only their deliveries.

    StructJSON tagQuery stringfor rangeappend

  2. One delivery at a time

    Exercise 2 · 100 XP · 2 objectives checked by tests

    In the app, a courier taps a delivery to see its details. Each delivery needs its own URL.

    Route parameterHTTP status code404

  3. A new order

    Exercise 3 · 100 XP · 2 objectives checked by tests

    Shopkeepers call Margot to order a delivery, and Margot types everything on her phone. She would like the app to record the order directly.

    Request bodyPOST201

  4. No orders for the Moon

    Exercise 4 · 100 XP · 3 objectives checked by tests

    Bastien wanted to test the app: he ordered a delivery to “the Moon” (la-lune), with no customer name. It went into the round, and Yanis spent a good hour looking for the Moon.

    Validation422Error handling