<script lang="ts">
	import { onMount } from "svelte";

    interface Message {
        message: string
    }

    let data: Message;

    async function getMessage() {
        let response = await fetch("/api/test");
        data = await response.json();
    }

    onMount(async () => {
        await getMessage();
         
    });
</script>

<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
{#if data}
    <p>{data.message}</p>
{/if}