Grokking ExpressJS
0% completed
Grouping and Versioning Routes
The bookstore API returns each book with its author as a plain name, "author": "Jane Austen". A new mobile app needs the author's id as well, so the team wants to return "author": { "id": 2, "name": "Jane Austen" } instead. The change is small, but every existing client that reads book.author as a string would break the day it ships.
Versioning lets both answers exist at the same time: old clients keep calling /api/v1/books, and new clients call /api/v2/books. In Express, a version is a group of routers mounted under its own path
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%