Frontend: Boilerplate to integrate database.
This commit is contained in:
parent
c2906025dc
commit
f47f72ba17
2 changed files with 17 additions and 2 deletions
14
frontend/src/routes/+page.js
Normal file
14
frontend/src/routes/+page.js
Normal 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,
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
<script>
|
<script>
|
||||||
let prenom = "Yohan";
|
export let data;
|
||||||
|
let info = data.info[0];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="my-4">
|
<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>
|
</div>
|
Loading…
Add table
Reference in a new issue