diff --git a/src/docs/api.md b/src/docs/api.md new file mode 100644 index 0000000..b975779 --- /dev/null +++ b/src/docs/api.md @@ -0,0 +1,44 @@ +--- +title: API Reference +description: The API reference is a detailed documentation of all the endpoints available in the SVGL API. +--- + + + +## Introduction + +SVGL API is a RESTFul API that allows you to get all the information of the SVGs that are in the repository. + +## Limitations + +The API is currently open to everyone and does not require any authentication. However, there is a limit of **50** requests per day per IP address. If you exceed this limit, you will receive a _429_ error. + +## Base URL + +The base URL for the API is: + +```bash +https://svgl.vercel.app/api/svgs +``` + +## Endpoints + +
+ + +``` +https://svgl.vercel.app/api/svgs +``` + + + + + +``` +https://svgl.vercel.app/api/svgs?limit=10 +``` + + +
diff --git a/src/routes/api/+page.ts b/src/routes/api/+page.ts new file mode 100644 index 0000000..88129b9 --- /dev/null +++ b/src/routes/api/+page.ts @@ -0,0 +1,14 @@ +import { error } from '@sveltejs/kit'; + +export async function load() { + try { + const documentTitle = 'api'; + const post = await import(`../../docs/${documentTitle}.md`); + return { + content: post.default, + meta: post.metadata + }; + } catch (e) { + throw error(404, `Could not find this page`); + } +}