diff --git a/client/src/routes/NewRecipePage.tsx b/client/src/routes/NewRecipePage.tsx index fae2326..abb3114 100644 --- a/client/src/routes/NewRecipePage.tsx +++ b/client/src/routes/NewRecipePage.tsx @@ -150,7 +150,7 @@ export default function NewRecipePage({ const formData = new FormData() formData.append('image', recipeData.imageFile) - const uploadResponse = await fetch('http://localhost:3001/upload', { + const uploadResponse = await fetch('/project2/upload', { method: 'POST', body: formData, }) diff --git a/client/src/routes/RecipeDetailPage.tsx b/client/src/routes/RecipeDetailPage.tsx index 2a80b15..3e030a9 100644 --- a/client/src/routes/RecipeDetailPage.tsx +++ b/client/src/routes/RecipeDetailPage.tsx @@ -19,7 +19,7 @@ function getImageUrl(imageUrl: string | null | undefined) { } // Bilder som er lastet opp til backend - return `http://localhost:3001/${imageUrl.replace(/^\/+/, '')}` + return `/project2/${imageUrl.replace(/^\/+/, '')}` } // Henter oppskriften basert på ID-en i URL-en diff --git a/client/src/routes/RecipeListPage.tsx b/client/src/routes/RecipeListPage.tsx index b82ea84..52a6d56 100644 --- a/client/src/routes/RecipeListPage.tsx +++ b/client/src/routes/RecipeListPage.tsx @@ -23,7 +23,7 @@ function getImageUrl(imageUrl: string | null | undefined) { } // Bilder som er lastet opp til backend - return `http://localhost:3001/${imageUrl.replace(/^\/+/, '')}` + return `/project2/${imageUrl.replace(/^\/+/, '')}` } // Listen over alle oppskrifter eller søkeresultater diff --git a/deploy/apache-project2.conf b/deploy/apache-project2.conf index 6ad449e..ae24fa1 100644 --- a/deploy/apache-project2.conf +++ b/deploy/apache-project2.conf @@ -8,3 +8,8 @@ Alias /project2 /var/www/prosjekt2/client/dist ProxyPass /project2/graphql http://localhost:3001/graphql ProxyPassReverse /project2/graphql http://localhost:3001/graphql +ProxyPass /project2/uploads http://localhost:3001/uploads +ProxyPassReverse /project2/uploads http://localhost:3001/uploads + +ProxyPass /project2/upload http://localhost:3001/upload +ProxyPassReverse /project2/upload http://localhost:3001/upload