mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 06:39:22 +02:00
update server service requirenments
This commit is contained in:
@ -2,8 +2,8 @@ use std::{env, io};
|
||||
|
||||
use actix_codec::Framed;
|
||||
use actix_http::{h1, Response, SendResponse, ServiceConfig};
|
||||
use actix_server::Server;
|
||||
use actix_service::NewService;
|
||||
use actix_server::{Io, Server};
|
||||
use actix_service::{fn_service, NewService};
|
||||
use actix_utils::framed::IntoFramed;
|
||||
use actix_utils::stream::TakeItem;
|
||||
use futures::Future;
|
||||
@ -14,7 +14,8 @@ fn main() -> io::Result<()> {
|
||||
|
||||
Server::build()
|
||||
.bind("framed_hello", "127.0.0.1:8080", || {
|
||||
IntoFramed::new(|| h1::Codec::new(ServiceConfig::default()))
|
||||
fn_service(|io: Io<_>| Ok(io.into_parts().0))
|
||||
.and_then(IntoFramed::new(|| h1::Codec::new(ServiceConfig::default())))
|
||||
.and_then(TakeItem::new().map_err(|_| ()))
|
||||
.and_then(|(_req, _framed): (_, Framed<_, _>)| {
|
||||
SendResponse::send(_framed, Response::Ok().body("Hello world!"))
|
||||
|
Reference in New Issue
Block a user