Chapter 1 of the Discover Goravel track
First pedal strokes
Goravel's routes, JSON responses, a URL parameter, a controller and a view, with just enough Go.
4 exercises · 400 XP · about 1 h 15 min · free first chapter
RouteJSON responseRoute parameterVariableStringControllerStructMethodSliceViewTemplaterange
The chapter's exercises
-
In the saddle!
Exercise 1 · 100 XP · 2 objectives checked by tests
The Flying Gophers are a bike courier cooperative in Lyon, France. Margot, who founded it, is fed up with the whiteboard covered in arrows and the text messages that get lost. She wants an API for the couriers' app, and she picked Goravel, a Go framework that looks a lot like Laravel. The project is already created, and it runs right here, in your browser.
RouteJSON response
-
Courier of the day
Exercise 2 · 100 XP · 2 objectives checked by tests
Every morning, each courier opens the app, which greets them by their first name. Margot wants the API to do it.
-
A controller for the couriers
Exercise 3 · 100 XP · 2 objectives checked by tests
routes/web.go is growing, and Margot already has more ideas. As in Laravel, the routes' code will move into a controller. Margot's nephew, who “does some Go”, started CoursierController and put the list of couriers in it.
-
The depot board
Exercise 4 · 100 XP · 3 objectives checked by tests
At the depot, an old screen hangs above the bikes. Margot would like to show the list of couriers on it, in big letters, so everyone knows who is riding today.
ViewTemplaterange