aboutsummaryrefslogtreecommitdiffstats
path: root/rust/fatcat-openapi/examples/server/main.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-06-13 15:00:46 -0700
committerBryan Newbold <bnewbold@archive.org>2020-06-13 15:00:46 -0700
commit4575478d953fae3068959feef80517cafc826fea (patch)
treec0e888c56e88df69d8cc2811e8f51069e1e33fbe /rust/fatcat-openapi/examples/server/main.rs
parent94f72165f5b030c3189453249e05fab0dcf62d9b (diff)
downloadfatcat-cli-4575478d953fae3068959feef80517cafc826fea.tar.gz
fatcat-cli-4575478d953fae3068959feef80517cafc826fea.zip
copy codegen rust openapi client from fatcat repo
Diffstat (limited to 'rust/fatcat-openapi/examples/server/main.rs')
-rw-r--r--rust/fatcat-openapi/examples/server/main.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/rust/fatcat-openapi/examples/server/main.rs b/rust/fatcat-openapi/examples/server/main.rs
new file mode 100644
index 0000000..af089c2
--- /dev/null
+++ b/rust/fatcat-openapi/examples/server/main.rs
@@ -0,0 +1,25 @@
+//! Main binary entry point for fatcat_openapi implementation.
+
+#![allow(missing_docs)]
+
+use clap::{App, Arg};
+
+mod server;
+
+/// Create custom server, wire it to the autogenerated router,
+/// and pass it to the web server.
+fn main() {
+ env_logger::init();
+
+ let matches = App::new("server")
+ .arg(
+ Arg::with_name("https")
+ .long("https")
+ .help("Whether to use HTTPS or not"),
+ )
+ .get_matches();
+
+ let addr = "127.0.0.1:8080";
+
+ hyper::rt::run(server::create(addr, matches.is_present("https")));
+}