[−][src]Function ntex::web::server
pub fn server<F, I, S, B>(factory: F) -> HttpServer<F, I, S, B> where
F: Fn() -> I + Send + Clone + 'static,
I: IntoServiceFactory<S>,
S: ServiceFactory<Config = AppConfig, Request = Request>,
S::Error: ResponseError + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
Create new http server with application factory.
use ntex::web; #[ntex::main] async fn main() -> std::io::Result<()> { web::server( || web::App::new() .service(web::resource("/").to(|| async { web::HttpResponse::Ok() }))) .bind("127.0.0.1:59090")? .run() .await }