Node.js · Senior · Question 66 of 75
How should you evolve a public API without breaking existing clients?
- 1Never change the API after the first release
- 2Change the response format whenever needed; clients should update
- ✓Correct answer: Make additive changes, deprecate with clear timelines, and version breaking changes (URL, header or new fields)
Explanation
Removing or renaming fields breaks clients. Monitor usage of deprecated fields before removing them; the Deprecation and Sunset headers can announce it.