mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-22 05:58:21 -05:00
This commit is contained in:
parent
1de52decd3
commit
7b1f93b232
@ -14,7 +14,12 @@ use crate::server::routes;
|
|||||||
|
|
||||||
use actix_cors::Cors;
|
use actix_cors::Cors;
|
||||||
use actix_files as fs;
|
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 config::parser::Config;
|
||||||
use handlebars::Handlebars;
|
use handlebars::Handlebars;
|
||||||
use handler::paths::{file_path, FileType};
|
use handler::paths::{file_path, FileType};
|
||||||
@ -68,6 +73,7 @@ pub fn run(listener: TcpListener, config: Config) -> std::io::Result<Server> {
|
|||||||
.app_data(web::Data::new(config.clone()))
|
.app_data(web::Data::new(config.clone()))
|
||||||
.wrap(cors)
|
.wrap(cors)
|
||||||
.wrap(Logger::default()) // added logging middleware for logging.
|
.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).
|
// Serve images and static files (css and js files).
|
||||||
.service(
|
.service(
|
||||||
fs::Files::new("/static", format!("{}/static", public_folder_path))
|
fs::Files::new("/static", format!("{}/static", public_folder_path))
|
||||||
|
Loading…
Reference in New Issue
Block a user