From e44658641b75076b702e690df166820c1d133f24 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Thu, 26 May 2022 16:40:55 +0200 Subject: feat: Move to actix to enable compression Add compression and enable it by default. Also add `cargo-watch` to watch for changes. --- src/bin/actix.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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::().unwrap_or(3000); HttpServer::new(|| { App::new() + .wrap(middleware::Compress::default()) .service(index) .service(posts) }) -- cgit v1.2.3