diff options
Diffstat (limited to 'src/routes/api/about.json')
| -rw-r--r-- | src/routes/api/about.json/+server.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/routes/api/about.json/+server.ts b/src/routes/api/about.json/+server.ts new file mode 100644 index 0000000..cdfd7b7 --- /dev/null +++ b/src/routes/api/about.json/+server.ts @@ -0,0 +1,27 @@ + + + +/*** IMPORT ------------------------------------------- ***/ + +import { error, json } from "@sveltejs/kit"; + +/*** UTILITY ------------------------------------------ ***/ + +import { default as markdown } from "$lib/utility/markdown.ts"; + +/*** EXPORT ------------------------------------------- ***/ + +export const POST = async({ fetch, request }) => { + try { + const response = await fetch("https://about.webb.page", { + headers: { "Content-Type": "text/plain" }, + method: "GET" + }); + + const content = await response.text(); + return json({ content: markdown(content) }); + } catch(welp) { + console.error(`Error fetching About: ${String(welp)}`); + return error(500); + } +}; |