mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-28 15:30:16 +01:00
1634e67e99
With https://github.com/tokio-rs/axum/pull/404 and https://github.com/tokio-rs/axum/pull/402 all routes now have the same types and thus we don't need to nest them but can instead store them all in a map. This simplifies the routing quite a bit and is faster as well. High level changes: - Routes are now stored in a `HashMap<RouteId, Route<B>>`. - `Router::or` is renamed to `Router::merge` because thats what it does now. It copies all routes from one router to another. This also means overlapping routes will cause a panic which is nice win. - `Router::merge` now only accepts `Router`s so added `Router::fallback` for adding a global 404 handler. - The `Or` service has been removed. - `Router::layer` now only adds layers to the routes you actually have meaning middleware runs _after_ routing. I believe that addresses https://github.com/tokio-rs/axum/issues/380 but will test that on another branch. |
||
---|---|---|
.. | ||
async-graphql | ||
chat | ||
customize-extractor-error | ||
error-handling-and-dependency-injection | ||
form | ||
global-404-handler | ||
graceful_shutdown | ||
hello-world | ||
jwt | ||
key-value-store | ||
low-level-rustls | ||
multipart-form | ||
oauth | ||
print-request-response | ||
reverse-proxy | ||
sessions | ||
sse | ||
static-file-server | ||
templates | ||
testing | ||
tls-rustls | ||
todos | ||
tokio-postgres | ||
tracing-aka-logging | ||
unix-domain-socket | ||
validator | ||
versioning | ||
websockets | ||
README.md |
Examples
This folder contains numerous example showing how to use axum. Each example is setup as its own crate so its dependencies are clear.