[−][src]Trait hyperlocal::UnixServerExt
Extension trait for provisioning a hyper HTTP server over a Unix domain socket.
Example
use hyper::{Server, Body, Response, service::{make_service_fn, service_fn}}; use hyperlocal::UnixServerExt; let make_service = make_service_fn(|_| async { Ok::<_, hyper::Error>(service_fn(|_req| async { Ok::<_, hyper::Error>(Response::new(Body::from("It works!"))) })) }); Server::bind_unix("/tmp/hyperlocal.sock")?.serve(make_service).await?;
Required methods
pub fn bind_unix(
path: impl AsRef<Path>
) -> Result<Builder<SocketIncoming>, Error>
[src]
path: impl AsRef<Path>
) -> Result<Builder<SocketIncoming>, Error>
Convenience method for constructing a Server listening on a Unix socket.