1
0
mirror of https://github.com/actix/actix-website synced 2025-02-02 20:29:03 +01:00

22 lines
522 B
Rust
Raw Normal View History

2019-06-26 14:15:03 -04:00
// <brotli-two>
2019-12-29 02:59:48 +09:00
use actix_web::{http::ContentEncoding, dev::BodyEncoding, HttpResponse};
2019-06-26 14:15:03 -04:00
2019-12-29 02:59:48 +09:00
async fn index_br() -> HttpResponse {
2019-06-26 14:15:03 -04:00
HttpResponse::Ok().body("data")
}
2020-09-12 16:21:54 +01:00
#[actix_web::main]
2019-12-29 02:59:48 +09:00
async fn main() -> std::io::Result<()> {
2019-06-26 14:15:03 -04:00
use actix_web::{middleware, web, App, HttpServer};
HttpServer::new(|| {
App::new()
.wrap(middleware::Compress::new(ContentEncoding::Br))
.route("/", web::get().to(index_br))
})
2022-02-26 03:56:24 +00:00
.bind(("127.0.0.1", 8080))?
2019-06-26 14:15:03 -04:00
.run()
2019-12-29 02:59:48 +09:00
.await
2019-06-26 14:15:03 -04:00
}
// </brotli-two>