connect front to back

This commit is contained in:
Vincent Liao
2022-03-21 23:41:08 +07:00
parent 2a82e43727
commit 28852b7eb2

View File

@@ -1,4 +1,19 @@
<script context="module">
export async function load({ fetch }) {
const response = await fetch("/api/data");
const data = await response.json();
return {
status: response.status,
props: {
data: data
},
};
}
</script>
<script>
export let data;
</script>
<h1>Welcome to SvelteKit</h1>
@@ -7,3 +22,4 @@
</p>
<p class="underline">hello from branch</p>
<pre>{JSON.stringify(data)}</pre>