From 540eec0c826bc01af1b23042290bcfec7aa176f5 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 13 Sep 2019 12:21:36 -0700 Subject: API docs default to redoc, not swagger-ui --- rust/redoc/index.html | 24 ++++++++++++++++++++++++ rust/src/bin/fatcatd.rs | 11 ++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 rust/redoc/index.html (limited to 'rust') diff --git a/rust/redoc/index.html b/rust/redoc/index.html new file mode 100644 index 00000000..ac75c306 --- /dev/null +++ b/rust/redoc/index.html @@ -0,0 +1,24 @@ + + + + ReDoc + + + + + + + + + + + + + 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 { Ok(Response::with(( status::Found, - RedirectRaw("/swagger-ui".to_string()), + RedirectRaw("/redoc".to_string()), + ))) + } + fn redoc_handler(_: &mut Request) -> IronResult { + let html_type = "text/html".parse::().unwrap(); + Ok(Response::with(( + html_type, + status::Ok, + include_str!("../../redoc/index.html"), ))) } fn swaggerui_handler(_: &mut Request) -> IronResult { -- cgit v1.2.3