aboutsummaryrefslogtreecommitdiff
path: root/src/routes/api/about.json/+server.ts
blob: cdfd7b707d716099cb3a68cce8777f5e957135d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
  }
};