about summary refs log tree commit diff
path: root/services/nixcon-demo/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'services/nixcon-demo/src/main.rs')
-rw-r--r--services/nixcon-demo/src/main.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/services/nixcon-demo/src/main.rs b/services/nixcon-demo/src/main.rs
new file mode 100644
index 000000000000..226fe49ed1a3
--- /dev/null
+++ b/services/nixcon-demo/src/main.rs
@@ -0,0 +1,19 @@
+use rouille::Response;
+use std::env;
+use std::io;
+use std::process;
+
+const GREETING: &str = "Haló NixCon!";
+
+fn main() {
+    if let Some(arg) = env::args().last() {
+        if arg == "--cli" {
+            println!("{}", GREETING);
+            process::exit(0);
+        }
+    }
+
+    rouille::start_server("0.0.0.0:8080", move |req| {
+        rouille::log(req, io::stdout(), || Response::text(GREETING))
+    })
+}