| Crates.io | sa-token-plugin-warp |
| lib.rs | sa-token-plugin-warp |
| version | 0.1.12 |
| created_at | 2025-10-12 00:43:00.753287+00 |
| updated_at | 2025-12-17 04:51:25.369747+00 |
| description | Warp framework integration for sa-token-rust - All-in-one package |
| homepage | https://github.com/llc-993/sa-token-rust |
| repository | https://github.com/llc-993/sa-token-rust |
| max_upload_size | |
| id | 1878688 |
| size | 83,199 |
Warp framework integration for sa-token-rust.
[dependencies]
sa-token-plugin-warp = { version = "0.1.12", features = ["redis"] }
warp = "0.3"
tokio = { version = "1", features = ["full"] }
use warp::Filter;
use sa_token_plugin_warp::{SaTokenState, sa_token_filter};
use sa_token_storage_memory::MemoryStorage;
use std::sync::Arc;
#[tokio::main]
async fn main() {
let state = SaTokenState::builder()
.storage(Arc::new(MemoryStorage::new()))
.timeout(7200)
.build();
let routes = warp::path("api")
.and(warp::path("user"))
.and(sa_token_filter(state))
.and_then(user_handler);
warp::serve(routes)
.run(([127, 0, 0, 1], 3030))
.await;
}
金书记
Licensed under either of Apache-2.0 or MIT.