API Versioning
APIs evolve. Prism supports three versioning strategies — URL prefix, header, and query parameter — so you can introduce breaking changes without breaking existing clients.Quick Start
URL-Based Versioning
Versioning Strategies
- URL Prefix
- Header
- Query Parameter
/users, not /v1/users.Version Format
Parsing Versions
Comparable — v1 < v2 < v2.1.
Accessing the Version
In Route Handlers
Versioned Router
For cleaner separation, usePrismVersionedRouter:
Version-Specific Routes
Unsupported Version Response
When a client requests an unsupported version, the middleware returns a 400:400 Response
URL Prefix Path Stripping
With.urlPrefix, the version prefix is removed. The original versioned path is stored in userInfo["versionedPath"]:
Path Handling