summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api/examples/server.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-15 00:35:52 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-15 00:35:52 -0700
commit28978964a77e853031874230c2415b1b835e93fc (patch)
tree8080670ee5f60aee8ba058a5babf80eaca7b4ded /rust/fatcat-api/examples/server.rs
parent33a4cce0b97832f5f0301b318a0a50073ce6b615 (diff)
downloadfatcat-28978964a77e853031874230c2415b1b835e93fc.tar.gz
fatcat-28978964a77e853031874230c2415b1b835e93fc.zip
fmt and cleanup
Diffstat (limited to 'rust/fatcat-api/examples/server.rs')
-rw-r--r--rust/fatcat-api/examples/server.rs32
1 files changed, 19 insertions, 13 deletions
diff --git a/rust/fatcat-api/examples/server.rs b/rust/fatcat-api/examples/server.rs
index 79d7367e..e97d69ca 100644
--- a/rust/fatcat-api/examples/server.rs
+++ b/rust/fatcat-api/examples/server.rs
@@ -4,26 +4,26 @@
// Imports required by this file.
// extern crate <name of this crate>;
+extern crate clap;
extern crate fatcat;
-extern crate swagger;
-extern crate iron;
extern crate hyper_openssl;
-extern crate clap;
+extern crate iron;
+extern crate swagger;
// Imports required by server library.
// extern crate fatcat;
// extern crate swagger;
-extern crate futures;
extern crate chrono;
+extern crate futures;
#[macro_use]
extern crate error_chain;
+use clap::{App, Arg};
use hyper_openssl::OpensslServer;
-use hyper_openssl::openssl::x509::X509_FILETYPE_PEM;
-use hyper_openssl::openssl::ssl::{SslAcceptorBuilder, SslMethod};
use hyper_openssl::openssl::error::ErrorStack;
-use clap::{App, Arg};
-use iron::{Iron, Chain};
+use hyper_openssl::openssl::ssl::{SslAcceptorBuilder, SslMethod};
+use hyper_openssl::openssl::x509::X509_FILETYPE_PEM;
+use iron::{Chain, Iron};
use swagger::auth::AllowAllMiddleware;
mod server_lib;
@@ -44,9 +44,11 @@ fn ssl() -> Result<OpensslServer, ErrorStack> {
/// and pass it to the web server.
fn main() {
let matches = App::new("server")
- .arg(Arg::with_name("https")
- .long("https")
- .help("Whether to use HTTPS or not"))
+ .arg(
+ Arg::with_name("https")
+ .long("https")
+ .help("Whether to use HTTPS or not"),
+ )
.get_matches();
let server = server_lib::server().unwrap();
@@ -60,9 +62,13 @@ fn main() {
if matches.is_present("https") {
// Using Simple HTTPS
- Iron::new(chain).https("localhost:8080", ssl().expect("Failed to load SSL keys")).expect("Failed to start HTTPS server");
+ Iron::new(chain)
+ .https("localhost:8080", ssl().expect("Failed to load SSL keys"))
+ .expect("Failed to start HTTPS server");
} else {
// Using HTTP
- Iron::new(chain).http("localhost:8080").expect("Failed to start HTTP server");
+ Iron::new(chain)
+ .http("localhost:8080")
+ .expect("Failed to start HTTP server");
}
}