mirror of
https://github.com/actix/actix-website
synced 2025-01-23 00:25:55 +01:00
21 lines
419 B
Rust
21 lines
419 B
Rust
// <auto>
|
|
use actix_web::{get, middleware, App, HttpResponse, HttpServer};
|
|
|
|
#[get("/")]
|
|
async fn index() -> HttpResponse {
|
|
HttpResponse::Ok().body("data")
|
|
}
|
|
|
|
#[actix_web::main]
|
|
async fn main() -> std::io::Result<()> {
|
|
HttpServer::new(|| {
|
|
App::new()
|
|
.wrap(middleware::Compress::default())
|
|
.service(index)
|
|
})
|
|
.bind(("127.0.0.1", 8080))?
|
|
.run()
|
|
.await
|
|
}
|
|
// </auto>
|