小程序容器助力企业在金融与物联网领域实现高效合规运营,带来的新机遇与挑战如何管理?
1290
2022-10-13
Actix web是一个用于Rust的小巧,实用且极速的Web框架
Actix web is a simple, pragmatic and extremely fast web framework for Rust.
Supported HTTP/1.x and HTTP/2.0 protocolsStreaming and pipeliningKeep-alive and slow requests handlingClient/server WebSockets supportTransparent content compression/decompression (br, gzip, deflate)Configurable request routingMultipart streamsStatic assetsSSL support with OpenSSL or RustlsMiddlewares (Logger, Session, CORS, etc)Includes an asynchronous HTTP clientSupports Actix actor frameworkSupports Rust 1.40+
Docs
API documentation (master)API documentation (docs.rs)User guide
Example
Dependencies:
[dependencies]actix-web = "2"
Code:
use actix_web::{get, web, App, HttpServer, Responder};#[get("/{id}/{name}/index.html")]async fn index(info: web::Path<(u32, String)>) -> impl Responder { format!("Hello {}! id:{}", info.1, info.0)}#[actix_web::main]async fn main() -> std::io::Result<()> { HttpServer::new(|| App::new().service(index)) .bind("127.0.0.1:8080")? .run() .await}
More examples
BasicsStatefulMultipart streamsSimple websocketTeraAskama templatesDiesel integrationr2d2OpenSSLRustlsTcp/Websocket chatJson
You may consider checking out this directory for more examples.
Benchmarks
TechEmpower Framework Benchmark
License
This project is licensed under either of
Apache License, Version 2.0, (LICENSE-APACHE or http://apache.org/licenses/LICENSE-2.0)MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Code of Conduct
Contribution to the actix-web crate is organized under the terms of the Contributor Covenant, the maintainer of actix-web, @fafhrd91, promises to intervene to uphold that code of conduct.
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~