mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-21 21:48:21 -05:00
⚡ perf: Compression for the page responses of the search engine (#472)
This commit is contained in:
parent
ddb10f6584
commit
5b4864424a
@ -19,7 +19,7 @@ serde = {version="1.0.190", default-features=false, features=["derive"]}
|
|||||||
serde_json = {version="1.0.108", default-features=false}
|
serde_json = {version="1.0.108", default-features=false}
|
||||||
maud = {version="0.25.0", default-features=false, features=["actix-web"]}
|
maud = {version="0.25.0", default-features=false, features=["actix-web"]}
|
||||||
scraper = {version="0.18.1", default-features = false}
|
scraper = {version="0.18.1", default-features = false}
|
||||||
actix-web = {version="4.4.0", features = ["cookies", "macros"], default-features=false}
|
actix-web = {version="4.4.0", features = ["cookies", "macros", "compress-brotli"], default-features=false}
|
||||||
actix-files = {version="0.6.2", default-features=false}
|
actix-files = {version="0.6.2", default-features=false}
|
||||||
actix-cors = {version="0.6.4", default-features=false}
|
actix-cors = {version="0.6.4", default-features=false}
|
||||||
fake-useragent = {version="0.1.3", default-features=false}
|
fake-useragent = {version="0.1.3", default-features=false}
|
||||||
|
@ -21,7 +21,12 @@ use crate::server::router;
|
|||||||
use actix_cors::Cors;
|
use actix_cors::Cors;
|
||||||
use actix_files as fs;
|
use actix_files as fs;
|
||||||
use actix_governor::{Governor, GovernorConfigBuilder};
|
use actix_governor::{Governor, GovernorConfigBuilder};
|
||||||
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 cache::cacher::{Cacher, SharedCache};
|
use cache::cacher::{Cacher, SharedCache};
|
||||||
use config::parser::Config;
|
use config::parser::Config;
|
||||||
use handler::{file_path, FileType};
|
use handler::{file_path, FileType};
|
||||||
@ -73,6 +78,8 @@ pub fn run(
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
App::new()
|
App::new()
|
||||||
|
// Compress the responses provided by the server for the client requests.
|
||||||
|
.wrap(Compress::default())
|
||||||
.wrap(Logger::default()) // added logging middleware for logging.
|
.wrap(Logger::default()) // added logging middleware for logging.
|
||||||
.app_data(web::Data::new(config.clone()))
|
.app_data(web::Data::new(config.clone()))
|
||||||
.app_data(cache.clone())
|
.app_data(cache.clone())
|
||||||
|
Loading…
Reference in New Issue
Block a user