Files
main.tsmain
What you'll learn
- Enable URI versioning and explain what defaultVersion does and does not do
- Serve two versions of the same path from two controllers, and one route under several versions with an array
- Keep a route outside versions with VERSION_NEUTRAL
Press Run tests to start the app. Its log appears here.Graded endpoints
The create route serves version 1, the controller's default
The same handler serves version 2 through @Version(['1', '2'])
The original shape, a bare array of id, name and age
The new shape from the version 2 controller: full cats in an envelope with the total
Trimmed as version 1 clients expect
The full cat
With versioning on, a request that names no version matches no versioned route; defaultVersion is for routes, not requests
404, not a fallback to the latest
A version-neutral controller answers at its plain path
Neutral means outside versions: the versioned path does not exist