1
0
mirror of https://github.com/actix/actix-website synced 2025-02-13 00:25:35 +01:00

20 lines
477 B
Rust
Raw Normal View History

2020-01-02 18:33:33 +06:00
// <chunked>
2020-09-12 16:21:54 +01:00
use actix_web::{get, App, Error, HttpRequest, HttpResponse, HttpServer};
2020-01-02 18:33:33 +06:00
use bytes::Bytes;
use futures::future::ok;
use futures::stream::once;
2019-06-17 15:15:33 -04:00
2020-09-12 16:21:54 +01:00
#[get("/")]
async fn index(_req: HttpRequest) -> HttpResponse {
HttpResponse::Ok().streaming(once(ok::<_, Error>(Bytes::from_static(b"data"))))
2020-01-02 18:33:33 +06:00
}
// </chunked>
2019-06-26 01:58:47 -04:00
2020-09-12 16:21:54 +01:00
#[actix_web::main]
async fn main() {
HttpServer::new(|| App::new().service(index))
.bind("127.0.0.1:8080")
2020-01-02 18:33:33 +06:00
.unwrap()
2020-01-02 18:36:32 +06:00
.run();
2020-01-02 18:33:33 +06:00
}