about summary refs log tree commit diff
path: root/services/nixcon-demo/src/main.rs
blob: 226fe49ed1a30c830edd789cfd18392bd27dabb8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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))
    })
}