Registry / web-framework / axum-session

axum-session

JSON →
library0.19.0rscratesunverified

Session management layer for axum that supports HTTP and REST, providing session storage and retrieval.

# Cargo.toml [dependencies] axum_session = "0.19.0"
INSTALL
IMPORT
SIG · AXUM-SESSION
A
axum-session
web-frameworkrustv0.19.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SessionLayer
use axum_session::SessionLayer;

Create a session store and attach the session layer to an axum router.

use axum::{Router, routing::get}; use axum_session::{SessionLayer, SessionConfig, SessionStore}; use std::sync::Arc; #[tokio::main] async fn main() { let store = SessionStore::new(None, SessionConfig::default()).await.unwrap(); let app = Router::new() .route("/", get(|| async { "Hello, session!" })) .layer(SessionLayer::new(store)); axum::Server::bind(&"0.0.0.0:3000".parse().unwrap()) .serve(app.into_make_service()) .await .unwrap(); }
Debug
Known issues
gotchaRequires a tokio runtime; will panic if used outside async context.
fix
Wrap main with #[tokio::main] or use an async runtime.
affects: >=0.1.0
Upgrade
Version history
0.19.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
22
OpenAI (training)
1
Resources
axum-session — cargo add axum-session · libregistry