首页 > TAG信息列表 > axum

rust web 的自定义extract获取jwt

刚开始学习rust的时候,web框架一大堆,感觉无所适从。有的框架类似于 springboot里注解的方式 使用宏,有的是用函数的方式。 随着异步框架 tokio地位的稳固,axum是一个不错的选择。axum采用的是函数的方式。 其实框架里是写好的验证处理程序的。源码里有基本验证和令牌验证两种方式。

【Axum】返回 JSON 文本

环境 Time 2022-01-16 Rust 1.58.0 Axum 0.4.4 概念 参考:https://docs.rs/axum/latest/axum/index.html 示例 main.rs use axum::{routing::get, Json, Router}; use serde_json::Value; use std::net::SocketAddr; #[tokio::main] async fn main() { let app = Router::ne

【Axum】返回 JSON 对象

环境 Time 2022-01-16 Rust 1.58.0 Axum 0.4.4 概念 参考:https://docs.rs/axum/latest/axum/index.html 示例 toml [package] edition = "2021" name = "game" version = "0.1.0" [dependencies] axum = "*" serde = {version = "*&