diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-09-18 20:05:39 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-09-18 20:36:06 -0700 |
commit | c0ad5f80c13fc66240a17e59dfff559c6967aac7 (patch) | |
tree | 2e8a0174bd2afda64362c7c9b07e88ce35997a2c /rust/fatcat-openapi/examples/server.rs | |
parent | bba9af573a7e6098e4fec13892e939e395c8d62f (diff) | |
download | fatcat-c0ad5f80c13fc66240a17e59dfff559c6967aac7.tar.gz fatcat-c0ad5f80c13fc66240a17e59dfff559c6967aac7.zip |
rust codegen (with rustfix, compiles 2018 edition)
Diffstat (limited to 'rust/fatcat-openapi/examples/server.rs')
-rw-r--r-- | rust/fatcat-openapi/examples/server.rs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/rust/fatcat-openapi/examples/server.rs b/rust/fatcat-openapi/examples/server.rs index 8d2e9b64..a033413b 100644 --- a/rust/fatcat-openapi/examples/server.rs +++ b/rust/fatcat-openapi/examples/server.rs @@ -4,17 +4,13 @@ // Imports required by this file. // extern crate <name of this crate>; -extern crate clap; -extern crate fatcat; -extern crate hyper_openssl; -extern crate iron; -extern crate swagger; +use fatcat_openapi; // Imports required by server library. -// extern crate fatcat; +// extern crate fatcat_openapi; // extern crate swagger; -extern crate chrono; -extern crate futures; +use chrono; +use futures; #[macro_use] extern crate error_chain; @@ -24,7 +20,6 @@ use hyper_openssl::openssl::ssl::{SslAcceptorBuilder, SslMethod}; use hyper_openssl::openssl::x509::X509_FILETYPE_PEM; use hyper_openssl::OpensslServer; use iron::{Chain, Iron}; -use swagger::auth::AllowAllMiddleware; mod server_lib; @@ -46,13 +41,13 @@ fn main() { let matches = App::new("server").arg(Arg::with_name("https").long("https").help("Whether to use HTTPS or not")).get_matches(); let server = server_lib::server().unwrap(); - let router = fatcat::router(server); + let router = fatcat_openapi::router(server); let mut chain = Chain::new(router); - chain.link_before(fatcat::server::ExtractAuthData); + chain.link_before(fatcat_openapi::server::ExtractAuthData); // add authentication middlewares into the chain here // for the purpose of this example, pretend we have authenticated a user - chain.link_before(AllowAllMiddleware::new("cosmo")); + //chain.link_before(AllowAllMiddleware::new("cosmo")); if matches.is_present("https") { // Using Simple HTTPS |