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

18 lines
417 B
Rust
Raw Normal View History

2019-06-15 16:37:08 -04:00
// <main>
use actix_web::{App, Body, HttpRequest, HttpResponse};
use bytes::Bytes;
use futures::stream::once;
fn index(_req: &HttpRequest) -> HttpResponse {
let body = once(Ok(Bytes::from_static(b"test")));
HttpResponse::Ok()
.content_type("application/json")
.body(Body::Streaming(Box::new(body)))
}
pub fn main() {
App::new().resource("/async", |r| r.f(index)).finish();
}
// </main>