Proxy API and webapp through NGINX as well

This commit is contained in:
thiloho
2024-08-13 22:14:47 +02:00
parent 6785bd0dfa
commit cf1600671b
18 changed files with 258 additions and 315 deletions

View File

@@ -1,29 +1,23 @@
import type { LayoutServerLoad } from "./$types";
export const load: LayoutServerLoad = async ({ params, fetch, cookies }) => {
const websiteData = await fetch(
`http://localhost:${process.env.ARCHTIKA_API_PORT}/website?id=eq.${params.websiteId}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${cookies.get("session_token")}`,
Accept: "application/vnd.pgrst.object+json"
}
const websiteData = await fetch(`/api/website?id=eq.${params.websiteId}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${cookies.get("session_token")}`,
Accept: "application/vnd.pgrst.object+json"
}
);
});
const homeData = await fetch(
`http://localhost:${process.env.ARCHTIKA_API_PORT}/home?website_id=eq.${params.websiteId}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${cookies.get("session_token")}`,
Accept: "application/vnd.pgrst.object+json"
}
const homeData = await fetch(`/api/home?website_id=eq.${params.websiteId}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${cookies.get("session_token")}`,
Accept: "application/vnd.pgrst.object+json"
}
);
});
const website = await websiteData.json();
const home = await homeData.json();