aboutsummaryrefslogtreecommitdiff
path: root/src/bin/actix.rs
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2022-05-26 16:40:55 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2022-05-26 16:40:55 +0200
commite44658641b75076b702e690df166820c1d133f24 (patch)
tree4f57d70ef6ccac1fa9ce5d840ffb4e638964c00b /src/bin/actix.rs
parentd33e4b11bf059e4a7815a771efcef9d079f0e550 (diff)
downloadmacroblog.rs-e44658641b75076b702e690df166820c1d133f24.tar.gz
macroblog.rs-e44658641b75076b702e690df166820c1d133f24.tar.bz2
macroblog.rs-e44658641b75076b702e690df166820c1d133f24.zip
feat: Move to actix to enable compression
Add compression and enable it by default. Also add `cargo-watch` to watch for changes.
Diffstat (limited to 'src/bin/actix.rs')
-rw-r--r--src/bin/actix.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bin/actix.rs b/src/bin/actix.rs
index 4137713..3f00f36 100644
--- a/src/bin/actix.rs
+++ b/src/bin/actix.rs
@@ -1,4 +1,4 @@
-use actix_web::{get, web, App, HttpResponse, HttpServer, Responder, http::header::ContentType};
+use actix_web::{get, web, middleware, App, HttpResponse, HttpServer, Responder, http::header::ContentType};
use macroblog::blog::{render_index_page, render_post_page};
use std::{env};
@@ -27,6 +27,7 @@ async fn main() -> std::io::Result<()> {
let port = env::var("PORT").unwrap_or("3000".into()).parse::<u16>().unwrap_or(3000);
HttpServer::new(|| {
App::new()
+ .wrap(middleware::Compress::default())
.service(index)
.service(posts)
})