Actix Web
Actix Web 是一个功能强大、实用且速度极快的 Rust Web 框架
Actix Web 是一个功能强大、实用且速度极快的 Rust Web 框架
awc
依赖项:
[dependencies]
actix-web = "4"
代码:
use actix_web::{get, web, App, HttpServer, Responder};
#[get("/hello/{name}")]
async fn greet(name: web::Path<String>) -> impl Responder {
format!("Hello {name}!")
}
#[actix_web::main] // or #[tokio::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new().service(greet)
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}
您可以考虑查看此目录以获取更多示例。
根据TechEmpower Framework Benchmark提供的最快的 Web 框架之一。
该项目根据以下任一许可证获得许可,您可以选择:
对 actix-web 存储库的贡献是根据贡献者契约的条款组织的。Actix 团队承诺进行干预以维护该行为准则。