Skip to content

Commit

Permalink
examples/actix-web.rs: default enable compress middleware. (#192)
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Davies <jpds@protonmail.com>
  • Loading branch information
jpds committed Mar 31, 2024
1 parent de27234 commit b462e61
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/actix-web.rs
@@ -1,5 +1,6 @@
use std::sync::Mutex;

use actix_web::middleware::Compress;
use actix_web::{web, App, HttpResponse, HttpServer, Responder, Result};
use prometheus_client::encoding::text::encode;
use prometheus_client::encoding::{EncodeLabelSet, EncodeLabelValue};
Expand Down Expand Up @@ -61,6 +62,7 @@ async fn main() -> std::io::Result<()> {

HttpServer::new(move || {
App::new()
.wrap(Compress::default())
.app_data(metrics.clone())
.app_data(state.clone())
.service(web::resource("/metrics").route(web::get().to(metrics_handler)))
Expand Down

0 comments on commit b462e61

Please sign in to comment.