Frontend: Boilerplate to integrate database.

This commit is contained in:
Yohan Boujon 2023-11-12 15:03:38 +01:00
parent c2906025dc
commit f47f72ba17
2 changed files with 17 additions and 2 deletions

View file

@ -0,0 +1,14 @@
export async function load(context) {
const res = await context.fetch("http://0.0.0.0:8000/info");
const info = await res.json();
if (!res.ok) {
return {
status: 500,
error: new Error("Internal Server Error"),
};
}
return {
info,
};
}

View file

@ -1,7 +1,8 @@
<script>
let prenom = "Yohan";
export let data;
let info = data.info[0];
</script>
<div class="my-4">
<h1 class="h1 text-center">Le super CV de {prenom}</h1>
<h1 class="h1 text-center">Le super CV de {info.full_name}</h1>
</div>