api-version
Axum middleware to rewrite a request such that a version prefix is added to the path. This is based on a set of versions and an optional "x-api-version"
custom HTTP header: if no such header is present, the highest version is used. Yet this only applies to requests the URIs of which pass a filter; others are not rewritten.
Paths must not start with a version prefix, e.g. "/v0"
.
Example
use api_version;
let app = new
.route
.route
.route;
/// Create an [ApiVersionLayer] correctly initialized with non-empty and strictly monotonically
/// increasing versions in the given inclusive range as well as an [ApiVersionFilter] making all
/// requests be rewritten.
let app = api_version!.layer;
License
This code is open source software licensed under the Apache 2.0 License.