2019-06-17 15:15:33 -04:00
|
|
|
// <identity>
|
2019-06-26 14:15:03 -04:00
|
|
|
use actix_web::{
|
2022-02-26 03:56:24 +00:00
|
|
|
get, http::header::ContentEncoding, middleware, App, HttpResponse, HttpServer,
|
2019-06-26 14:15:03 -04:00
|
|
|
};
|
2019-06-17 15:15:33 -04:00
|
|
|
|
2020-09-12 16:21:54 +01:00
|
|
|
#[get("/")]
|
2019-12-29 02:59:48 +09:00
|
|
|
async fn index() -> HttpResponse {
|
2019-06-17 15:15:33 -04:00
|
|
|
HttpResponse::Ok()
|
|
|
|
// v- disable compression
|
2022-02-26 03:56:24 +00:00
|
|
|
.insert_header(ContentEncoding::Identity)
|
2019-06-17 15:15:33 -04:00
|
|
|
.body("data")
|
|
|
|
}
|
2019-06-19 00:20:50 -04:00
|
|
|
|
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
|
|
|
HttpServer::new(|| {
|
|
|
|
App::new()
|
|
|
|
.wrap(middleware::Compress::default())
|
2020-09-12 16:21:54 +01:00
|
|
|
.service(index)
|
2019-06-26 14:15:03 -04:00
|
|
|
})
|
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-19 00:20:50 -04:00
|
|
|
}
|
2019-06-26 14:15:03 -04:00
|
|
|
// </identity>
|