2 releases

0.1.1-alpha Aug 21, 2023
0.1.0 Jan 27, 2022

#1084 in HTTP server

GPL-3.0 license

7KB
103 lines

afire-compress

🦄 afire middleware to compress outgoing HTTP traffic.

Supports Gzip, Deflate, and Brotli. Make sure this is the first middleware added to a server.

Example

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:

Compress outgoing HTTP

Dependencies

~2MB
~38K SLoC