diff options
| author | Teddy Wing | 2020-07-04 15:35:09 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2020-07-04 15:35:09 +0200 | 
| commit | b470de2c475940bd1bf7ade73e3b1c911be897e6 (patch) | |
| tree | 5581429a487f99d08bc8ba1c8f3a428f5d1e7c5f | |
| parent | 5a207c6649a67871c209f8e1634efcbcc719bee6 (diff) | |
| download | fastcgi-conduit-b470de2c475940bd1bf7ade73e3b1c911be897e6.tar.bz2 | |
Add examples/small.rs
Copy the short example from the module documentation into an executable
file.
| -rw-r--r-- | examples/small.rs | 16 | 
1 files changed, 16 insertions, 0 deletions
| diff --git a/examples/small.rs b/examples/small.rs new file mode 100644 index 0000000..160bd6a --- /dev/null +++ b/examples/small.rs @@ -0,0 +1,16 @@ +use conduit::{header, Body, RequestExt, Response}; +use fastcgi_conduit::Server; + + +fn main() { +    Server::start(handler).unwrap(); +} + +fn handler(_req: &mut dyn RequestExt) -> std::io::Result<Response<Body>> { +    Ok( +        Response::builder() +            .header(header::CONTENT_TYPE, "text/html") +            .body(Body::from_static(b"<h1>Hello</h1>")) +            .unwrap() +    ) +} | 
