feat(nixcon-demo): Add CLI mode for NixCon demo

Maybe a bit more sane than trying to do a network based setup.
This commit is contained in:
Vincent Ambo 2019-10-26 13:50:42 +02:00
parent 8ffe811d46
commit 161f1b5e85

View file

@ -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))
})
}