Skip to content

Commit

Permalink
examples/actix-web.rs: Default enable compress middleware.
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Davies <[email protected]>
  • Loading branch information
jpds committed Mar 28, 2024
1 parent de27234 commit 05b6480
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/actix-web.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::sync::Mutex;

use actix_web::{web, App, HttpResponse, HttpServer, Responder, Result};
use actix_web::middleware::Compress;
use prometheus_client::encoding::text::encode;
use prometheus_client::encoding::{EncodeLabelSet, EncodeLabelValue};
use prometheus_client::metrics::counter::Counter;
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 05b6480

Please sign in to comment.