Crates.io | afire_compress |
lib.rs | afire_compress |
version | 0.1.1-alpha |
source | src |
created_at | 2022-01-27 20:20:24.072508 |
updated_at | 2023-08-21 02:21:49.801623 |
description | 🦄 afire middleware to compress outgoing HTTP traffic |
homepage | |
repository | https://github.com/Basicprogrammer10/afire-compress |
max_upload_size | |
id | 522740 |
size | 10,177 |
🦄 afire middleware to compress outgoing HTTP traffic.
Supports Gzip
, Deflate
, and Brotli
.
Make sure this is the first middleware added to a server.
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();
}