parent
c1d8e6c19b
commit
d87c6e4fa4
1 changed files with 9 additions and 4 deletions
|
@ -30,13 +30,18 @@ fn main() {
|
||||||
mount.mount("/", graphiql_endpoint);
|
mount.mount("/", graphiql_endpoint);
|
||||||
mount.mount("/graphql", graphql_endpoint);
|
mount.mount("/graphql", graphql_endpoint);
|
||||||
|
|
||||||
let (logger_before, logger_after) = Logger::new(None);
|
|
||||||
|
|
||||||
let mut chain = Chain::new(mount);
|
let mut chain = Chain::new(mount);
|
||||||
chain.link_before(logger_before);
|
|
||||||
chain.link_after(logger_after);
|
// Temporary fix - Iron's logger middleware does not work on Windows
|
||||||
|
#[cfg(not(windows))] setup_logger(&mut chain);
|
||||||
|
|
||||||
let host = env::var("LISTEN").unwrap_or("0.0.0.0:8080".to_owned());
|
let host = env::var("LISTEN").unwrap_or("0.0.0.0:8080".to_owned());
|
||||||
println!("GraphQL server started on {}", host);
|
println!("GraphQL server started on {}", host);
|
||||||
Iron::new(chain).http(host.as_str()).unwrap();
|
Iron::new(chain).http(host.as_str()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn setup_logger(chain: &mut Chain) {
|
||||||
|
let (logger_before, logger_after) = Logger::new(None);
|
||||||
|
chain.link_before(logger_before);
|
||||||
|
chain.link_after(logger_after);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue