From 8ffe811d46a45ee19d863e72ab22417390698d31 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 26 Oct 2019 13:27:56 +0200 Subject: feat(services): Add nixcon-demo service with simple web server --- services/nixcon-demo/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 services/nixcon-demo/src/main.rs (limited to 'services/nixcon-demo/src/main.rs') diff --git a/services/nixcon-demo/src/main.rs b/services/nixcon-demo/src/main.rs new file mode 100644 index 000000000000..c05124aaa3d8 --- /dev/null +++ b/services/nixcon-demo/src/main.rs @@ -0,0 +1,8 @@ +use std::io; +use rouille::Response; + +fn main() { + rouille::start_server("0.0.0.0:8080", move |req| { + rouille::log(req, io::stdout(), || Response::text("Haló NixCon!")) + }) +} -- cgit 1.4.1 From 161f1b5e85899446753bce465579aaee366be780 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 26 Oct 2019 13:50:42 +0200 Subject: feat(nixcon-demo): Add CLI mode for NixCon demo Maybe a bit more sane than trying to do a network based setup. --- services/nixcon-demo/src/main.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'services/nixcon-demo/src/main.rs') diff --git a/services/nixcon-demo/src/main.rs b/services/nixcon-demo/src/main.rs index c05124aaa3d8..226fe49ed1a3 100644 --- a/services/nixcon-demo/src/main.rs +++ b/services/nixcon-demo/src/main.rs @@ -1,8 +1,19 @@ -use std::io; 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("Haló NixCon!")) + rouille::log(req, io::stdout(), || Response::text(GREETING)) }) } -- cgit 1.4.1