Shut down server when quitting

This commit is contained in:
Antoine Gersant 2016-09-21 23:44:41 -07:00
parent f82ddc484c
commit e631138562

View file

@ -37,8 +37,7 @@ mod vfs;
fn main() {
println!("Spawning server thread");
std::thread::spawn(move || {
println!("Starting up server");
let mut api_chain;
{
let api_handler;
@ -59,8 +58,10 @@ fn main() {
let mut mount = Mount::new();
mount.mount("/api/", api_chain);
mount.mount("/", Static::new(Path::new("web")));
Iron::new(mount).http("localhost:3000").unwrap();
});
let mut server = Iron::new(mount).http("localhost:3000").unwrap();
ui::run();
println!("Shutting down server");
server.close().unwrap();
}