initial production commit

This commit is contained in:
Fred 2025-07-25 18:07:20 +00:00
parent 6f43d17ddd
commit 773b4773eb
9 changed files with 116 additions and 93 deletions

View file

@ -10,4 +10,4 @@ COPY . .
EXPOSE 80
CMD ["npm", "run", "dev"]
CMD ["npm", "run", "production"]

View file

@ -4,7 +4,8 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite --host --port 80",
"dev": "vite --host 0.0.0.0 --port 80",
"production": "vite --host 0.0.0.0 --port 80",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"

View file

@ -1,34 +1,34 @@
export const getRecipes = async () => {
const response = await fetch("http://localhost:3000/recipes");
const response = await fetch("/backend/recipes");
const data = await response.json();
return data;
};
export const getRecipeSteps = async () => {
const response = await fetch("http://localhost:3000/recipe-steps");
const response = await fetch("/backend/recipe-steps");
const data = await response.json();
return data;
};
export const getRecipeIngredients = async () => {
const response = await fetch("http://localhost:3000/recipe-ingredients");
const response = await fetch("/backend/recipe-ingredients");
const data = await response.json();
return data;
};
export const getRecipeById = async (id) => {
const response = await fetch(`http://localhost:3000/recipe/${id}`);
const response = await fetch(`/backend/recipe/${id}`);
const data = await response.json();
return data;
};
export const addRecipe = async (recipeData) => {
console.log(JSON.stringify(recipeData))
console.log(JSON.stringify(recipeData));
// return
const response = await fetch("http://localhost:3000/add-recipe", {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(recipeData)
const response = await fetch("/backend/add-recipe", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(recipeData),
});
const data = await response.json();
console.log(data);
@ -36,27 +36,26 @@ export const addRecipe = async (recipeData) => {
};
export const setDBStars = async (id, stars) => {
console.log(JSON.stringify({ id: id, stars: stars }))
console.log(JSON.stringify({ id: id, stars: stars }));
// return
const response = await fetch("http://localhost:3000/set-stars", {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: id, stars: stars })
const response = await fetch("/backend/set-stars", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ id: id, stars: stars }),
});
const data = await response.json();
console.log(data);
return data;
}
};
export const deleteRecipe = async (id) => {
console.log(id)
console.log(id);
// return
const response = await fetch("http://localhost:3000/delete-recipe", {
method: 'DELETE',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id })
const response = await fetch("/backend/delete-recipe", {
method: "DELETE",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ id }),
});
const data = await response.json();
return data;
};

View file

@ -1,7 +1,11 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
})
server: {
host: "ec683cee72d30c5030.fredzernia.com",
allowedHosts: ["ec683cee72d30c5030.fredzernia.com"],
},
});