mirror of
https://github.com/actix/actix-website
synced 2025-06-27 15:39:02 +02:00
update extractors
This commit is contained in:
@ -1,23 +1,22 @@
|
||||
// // <chunked>
|
||||
// use actix_web::{web, HttpRequest, HttpResponse};
|
||||
// use bytes::Bytes;
|
||||
// use futures::stream::once;
|
||||
// <chunked>
|
||||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use bytes::Bytes;
|
||||
use futures::future::ok;
|
||||
use futures::stream::once;
|
||||
|
||||
// fn index(req: HttpRequest) -> HttpResponse {
|
||||
// HttpResponse::Ok()
|
||||
// .chunked()
|
||||
// .body(Body::Streaming(Box::new(once(Ok(Bytes::from_static(
|
||||
// b"data",
|
||||
// ))))))
|
||||
// }
|
||||
// // </chunked>
|
||||
async fn index(req: HttpRequest) -> HttpResponse {
|
||||
HttpResponse::Ok()
|
||||
.chunked()
|
||||
.streaming(once(ok::<_, Error>(Bytes::from_static(b"data"))))
|
||||
}
|
||||
// </chunked>
|
||||
|
||||
// pub fn main() {
|
||||
// use actix_web::{web, App, HttpServer};
|
||||
pub fn main() {
|
||||
use actix_web::{web, App, HttpServer};
|
||||
|
||||
// HttpServer::new(|| App::new().route("/", web::get().to(index)))
|
||||
// .bind("127.0.0.1:8088")
|
||||
// .unwrap()
|
||||
// .run()
|
||||
// .unwrap();
|
||||
// }
|
||||
HttpServer::new(|| App::new().route("/", web::get().to(index)))
|
||||
.bind("127.0.0.1:8088")
|
||||
.unwrap()
|
||||
.run()
|
||||
.unwrap();
|
||||
}
|
||||
|
Reference in New Issue
Block a user