aboutsummaryrefslogtreecommitdiffstats
path: root/examples/small.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/small.rs')
-rw-r--r--examples/small.rs16
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()
+ )
+}