summaryrefslogtreecommitdiff
path: root/tools/hyper_hello/hyper_hello.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-07-06 13:00:08 -0400
committerGitHub <noreply@github.com>2020-07-06 13:00:08 -0400
commit75d9913b2208fe9faabbe1d9306252793a64269c (patch)
treeeb8a86abda4bce3ece7327c3a97880e1cbf2bc91 /tools/hyper_hello/hyper_hello.rs
parentc7afbdaee2398f24204843e278bc9aefc5e6bdfd (diff)
Remove tools/hyper_hello (#6651)
Diffstat (limited to 'tools/hyper_hello/hyper_hello.rs')
-rw-r--r--tools/hyper_hello/hyper_hello.rs40
1 files changed, 0 insertions, 40 deletions
diff --git a/tools/hyper_hello/hyper_hello.rs b/tools/hyper_hello/hyper_hello.rs
deleted file mode 100644
index 897ca07e9..000000000
--- a/tools/hyper_hello/hyper_hello.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-// Adapted from https://github.com/hyperium/hyper/blob/master/examples/hello.rs
-
-#![deny(warnings)]
-
-use std::convert::Infallible;
-use std::env;
-use std::error::Error;
-
-use hyper::service::{make_service_fn, service_fn};
-use hyper::{Body, Response, Server};
-
-type Just<T> = Result<T, Infallible>;
-
-#[tokio::main]
-async fn main() -> Result<(), Box<dyn Error>> {
- let mut port: u16 = 4544;
- if let Some(custom_port) = env::args().nth(1) {
- port = custom_port.parse::<u16>().unwrap();
- }
-
- let addr = ([127, 0, 0, 1], port).into();
-
- // For every connection, we must make a `Service` to handle all
- // incoming HTTP requests on said connection.
- let new_service = make_service_fn(|_| {
- // This is the `Service` that will handle the connection.
- // `service_fn` is a helper to convert a function that
- // returns a Response into a `Service`.
- async {
- Just::Ok(service_fn(|_req| async {
- Just::Ok(Response::new(Body::from(&b"Hello World!"[..])))
- }))
- }
- });
-
- let server = Server::bind(&addr).tcp_nodelay(true).serve(new_service);
- println!("Listening on http://{}", addr);
- Ok(server.await?)
-}