Showing
4 changed files
with
37 additions
and
0 deletions
| @@ -52,6 +52,7 @@ async fn main() -> std::io::Result<()> { | @@ -52,6 +52,7 @@ async fn main() -> std::io::Result<()> { | ||
| 52 | ) | 52 | ) |
| 53 | . service( web::scope("") | 53 | . service( web::scope("") |
| 54 | . route("/", web::get().to(root)) | 54 | . route("/", web::get().to(root)) |
| 55 | + . route("/api.html", web::get().to(apidoc)) | ||
| 55 | . route("/index", web::get().to(root)) | 56 | . route("/index", web::get().to(root)) |
| 56 | . route("/index.html", web::get().to(root)) | 57 | . route("/index.html", web::get().to(root)) |
| 57 | . route("/favicon", web::get().to(favicon)) | 58 | . route("/favicon", web::get().to(favicon)) |
| @@ -5,6 +5,10 @@ pub async fn root() -> Result<actix_files::NamedFile, Error> { | @@ -5,6 +5,10 @@ pub async fn root() -> Result<actix_files::NamedFile, Error> { | ||
| 5 | Ok(actix_files::NamedFile::open("static/index.html")?) | 5 | Ok(actix_files::NamedFile::open("static/index.html")?) |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | +pub async fn apidoc() -> Result<actix_files::NamedFile, Error> { | ||
| 9 | + Ok(actix_files::NamedFile::open("static/api.html")?) | ||
| 10 | +} | ||
| 11 | + | ||
| 8 | pub async fn p404() -> Result<actix_files::NamedFile, Error> { | 12 | pub async fn p404() -> Result<actix_files::NamedFile, Error> { |
| 9 | Ok(actix_files::NamedFile::open("static/404.html")?) | 13 | Ok(actix_files::NamedFile::open("static/404.html")?) |
| 10 | } | 14 | } |
static/api.html
0 → 100644
| 1 | +<!doctype html> | ||
| 2 | +<html lang="en"> | ||
| 3 | + <head> | ||
| 4 | + <meta charset="utf-8"> | ||
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
| 6 | + <title>Elements in HTML</title> | ||
| 7 | + <!-- Embed elements Elements via Web Component --> | ||
| 8 | + <script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script> | ||
| 9 | + <link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css"> | ||
| 10 | + </head> | ||
| 11 | + <body> | ||
| 12 | + | ||
| 13 | + <elements-api | ||
| 14 | + apiDescriptionUrl="/static/openapi.yaml" | ||
| 15 | + router="hash" | ||
| 16 | + layout="sidebar" | ||
| 17 | + /> | ||
| 18 | + | ||
| 19 | + </body> | ||
| 20 | +</html> |
static/openapi.yaml
0 → 100644
| 1 | +openapi: 3.0.0 | ||
| 2 | +info: | ||
| 3 | + version: 0.0.1 | ||
| 4 | + title: Artshop API | ||
| 5 | + description: A first simple try do document out api | ||
| 6 | +paths: | ||
| 7 | + /api/v0/markdowns: | ||
| 8 | + get: | ||
| 9 | + description: Returns a list of all available markdown documents. | ||
| 10 | + responses: | ||
| 11 | + '200': | ||
| 12 | + description: Successful response |
Please
register
or
login
to post a comment