diff --git a/src/lib.rs b/src/lib.rs index e76344b..97bff01 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,7 +14,12 @@ use crate::server::routes; use actix_cors::Cors; use actix_files as fs; -use actix_web::{dev::Server, http::header, middleware::Logger, web, App, HttpServer}; +use actix_web::{ + dev::Server, + http::header, + middleware::{Compress, Logger}, + web, App, HttpServer, +}; use config::parser::Config; use handlebars::Handlebars; use handler::paths::{file_path, FileType}; @@ -68,6 +73,7 @@ pub fn run(listener: TcpListener, config: Config) -> std::io::Result { .app_data(web::Data::new(config.clone())) .wrap(cors) .wrap(Logger::default()) // added logging middleware for logging. + .wrap(Compress::default()) // compress request headers to reduce memory usage. // Serve images and static files (css and js files). .service( fs::Files::new("/static", format!("{}/static", public_folder_path))