2个版本
0.1.1-alpha | 2023年8月21日 |
---|---|
0.1.0 | 2022年1月27日 |
在HTTP服务器类别中排名1084
7KB
103 代码行
afire-compress
🦄 afire中间件用于压缩发出的HTTP流量。
支持Gzip
、Deflate
和Brotli
。请确保这是添加到服务器中的第一个中间件。
示例
use afire::{Method, Response, Server};
use afire_compress::{Compress, CompressType};
fn main() {
let mut server = Server::new("localhost", 8080);
// Add Compressor
Compress::new().attach(&mut server);
server.route(Method::GET, "/", |_| Response::new().text("Hello World"));
server.start().unwrap();
}
lib.rs
:
压缩发出的HTTP
依赖
~2MB
~38K SLoC