diff options
| author | Fuwn <[email protected]> | 2022-03-09 01:14:56 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-03-09 01:14:56 +0000 |
| commit | d7385a2a35b9584d7d7fc71b19f9b4a409b2d951 (patch) | |
| tree | b33074686057b4e1d56cea6b935506e6c257b78a /src | |
| parent | fix(header): replace api link (diff) | |
| download | archived-frontend-next-d7385a2a35b9584d7d7fc71b19f9b4a409b2d951.tar.xz archived-frontend-next-d7385a2a35b9584d7d7fc71b19f9b4a409b2d951.zip | |
feat(routes): auto-generated api docs
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/header/Header.svelte | 8 | ||||
| -rw-r--r-- | src/routes/api.svelte | 50 |
2 files changed, 51 insertions, 7 deletions
diff --git a/src/lib/header/Header.svelte b/src/lib/header/Header.svelte index 671769e..77ef218 100644 --- a/src/lib/header/Header.svelte +++ b/src/lib/header/Header.svelte @@ -21,13 +21,7 @@ SPDX-License-Identifier: GPL-3.0-only --> Route senpy[3] = [ <a sveltekit:prefetch href="/">home</a>, <a sveltekit:prefetch href="/languages">languages</a>, - <a - sveltekit:prefetch - href="https://api.senpy.club/" - target="_blank" - > - api - </a> + <a sveltekit:prefetch href="/api">api</a> ]; </nav> </header> diff --git a/src/routes/api.svelte b/src/routes/api.svelte new file mode 100644 index 0000000..e167fa7 --- /dev/null +++ b/src/routes/api.svelte @@ -0,0 +1,50 @@ +<!-- This file is part of api-worker <https://github.com/senpy-club/api-worker>. +Copyright (C) 2022-2022 Fuwn <[email protected]> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 3. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. + +Copyright (C) 2022-2022 Fuwn <[email protected]> +SPDX-License-Identifier: GPL-3.0-only --> +<script> + import { onMount } from "svelte"; + import rst2html from "rst2html"; + + let rst; + let complete = false; + + onMount(async () => { + rst = await (await fetch("https://api.senpy.club")).text(); + complete = true; + }); +</script> + +<svelte:head> + <title>API | The Senpy Club</title> +</svelte:head> + +<section> + <h1>API</h1> + + <p>This documentation is auto-generated, there may be errors.</p> + + <p> + The Senpy Club API can be accessed at + <a href="https://api.senpy.club" target="_blank">https://api.senpy.club</a>. + </p> + + {#if !complete} + <p>Fetching API README...</p> + {:else} + {@html rst2html(rst)} + {/if} +</section> |