This is just a simple example of a HTTPS server written in Rust using the Axum framework.
- It have tracing instrumentation.
- It implements basic in-memory sessions based on cookies.
- It serves public static files.
- It uses RustTLS for https which enables HTTP2 protocol (axum flag
http2
must be enabled). - It supports brotli compression
# run the server
cargo run
# run the server in watch mode
cargo watch -q -c -w src/ -x run
# enable tower_http request/response tracing
RUST_LOG=example_server_axum=debug,tower_http=trace cargo run
# enable tower_http request/response tracing and run the server in watch mode
RUST_LOG=example_server_axum=debug,tower_http=trace cargo watch -q -c -w src/ -w public/index.html -x run
Note: you need to
cargo install cargo-watch
to use the watch mode.
- handle session not found for cookie found (BUG).
- upgrade versions of axum, tower-http and axum-server.
- Things that can be created from a requests.
FromRequest
is generic over the request body.
- A response can be created from any type that implements
IntoResponse
. - Types that implement IntoResponse can be returned from handlers.
- Async Session
- Axum Feature Flags
- Axum Examples
- Tracing
- Tracing Examples
- Tracing Subscriber
- Tower HTTP Trace
- Env Logger
- Log
- Rust Unofficial Patterns
git tag v0.1.1
git push
git push --tags