aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-09-13 12:21:36 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-09-13 12:21:36 -0700
commit540eec0c826bc01af1b23042290bcfec7aa176f5 (patch)
tree685c08f4fb426ed3ef1283a01e098ff6ed8100fa /rust/src
parent0e1ddd94f7f210391dfc34ddcc370d63ef497c16 (diff)
downloadfatcat-540eec0c826bc01af1b23042290bcfec7aa176f5.tar.gz
fatcat-540eec0c826bc01af1b23042290bcfec7aa176f5.zip
API docs default to redoc, not swagger-ui
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/bin/fatcatd.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/rust/src/bin/fatcatd.rs b/rust/src/bin/fatcatd.rs
index 67ec3123..4d1f1a88 100644
--- a/rust/src/bin/fatcatd.rs
+++ b/rust/src/bin/fatcatd.rs
@@ -107,13 +107,22 @@ fn main() -> Result<()> {
let mut router = fatcat_openapi::router(server);
router.get("/", root_handler, "root-redirect");
+ router.get("/redoc", redoc_handler, "redoc-html");
router.get("/swagger-ui", swaggerui_handler, "swagger-ui-html");
router.get("/v0/openapi2.yml", yaml_handler, "openapi2-spec-yaml");
fn root_handler(_: &mut Request) -> IronResult<Response> {
Ok(Response::with((
status::Found,
- RedirectRaw("/swagger-ui".to_string()),
+ RedirectRaw("/redoc".to_string()),
+ )))
+ }
+ fn redoc_handler(_: &mut Request) -> IronResult<Response> {
+ let html_type = "text/html".parse::<iron::mime::Mime>().unwrap();
+ Ok(Response::with((
+ html_type,
+ status::Ok,
+ include_str!("../../redoc/index.html"),
)))
}
fn swaggerui_handler(_: &mut Request) -> IronResult<Response> {