The couriers' app and the depot board have their URLs all mixed together. Margot would like to put everything the app uses under /api, as in the Laravel projects she has seen.
Your mission
- In
routes/web.go, create a route group with the/apiprefix. - Move the three delivery routes into it:
GET /api/deliveries,GET /api/deliveries/{id}andPOST /api/deliveries. - The old URLs,
/deliveries…, no longer exist./ping,/couriersand/boardstay where they are. (Goravel also has aroutes/api.go, which this course's skeleton doesn't use: everything stays inroutes/web.go.)
Reminder
Prefix("/api").Group(…) is Laravel's Route::prefix('api')->group(…). The group receives an anonymous function, written on the spot, which in turn receives a router: the routes declared on it get the prefix.
In Go, every package you use must be imported, and every import must be used: the compiler refuses both mistakes. route.Router is a type from Goravel's contracts/route package, so it has to be added to the imports.