1use std::{env, path::Path, thread, time::Duration};
2
3use breb::LiveServer;
4
5fn main() {
6 let port = env::args().nth(1)
7 .map(|s| s.parse::<u16>())
8 .transpose()
9 .expect("that port wasn't an integer");
10
11 let Ok(manifest_dir) = env::var("CARGO_MANIFEST_DIR") else {
12 panic!("you need to run this as an example with cargo.");
13 };
14 let manifest_dir = Path::new(&manifest_dir);
15 let example_dir = manifest_dir.join("examples/simple/");
16
17 let in_bg = LiveServer::live_config(example_dir.join("breb.yml"), example_dir)
18 .listen_background(port)
19 .expect("failed to start server");
20 println!("server is listening on http://{}", in_bg.address);
21 loop {
23 thread::sleep(Duration::MAX);
24 }
25}