aboutsummaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
Diffstat (limited to 'rust')
-rw-r--r--rust/redoc/index.html24
-rw-r--r--rust/src/bin/fatcatd.rs11
2 files changed, 34 insertions, 1 deletions
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 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>ReDoc</title>
+ <!-- needed for adaptive design -->
+ <meta charset="utf-8"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
+
+ <!--
+ ReDoc doesn't change outer page styles
+ -->
+ <style>
+ body {
+ margin: 0;
+ padding: 0;
+ }
+ </style>
+ </head>
+ <body>
+ <redoc spec-url='/v0/openapi2.yml'></redoc>
+ <script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
+ </body>
+</html>
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> {