diff --git a/backend/src/index.js b/backend/src/index.js index 68d0c26..81a603d 100644 --- a/backend/src/index.js +++ b/backend/src/index.js @@ -7,8 +7,9 @@ const connectDB = require("./db"); // connect database connectDB(); -app.get("/", (req, res) => { - res.send("Hello from Proxmox container!"); +app.get("/api/test", (req, res) => { + console.log("Hey"); + res.json({"message": "Hello from backend!"}); }); app.listen(5000, () => { diff --git a/frontend/.env.production b/frontend/.env.production new file mode 100644 index 0000000..497ef1c --- /dev/null +++ b/frontend/.env.production @@ -0,0 +1 @@ +API_BASE_URL=https://aranroig.com/api diff --git a/frontend/.gitignore b/frontend/.gitignore index 4a7f73a..d7d7e54 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -21,4 +21,4 @@ logs # Local env files .env .env.* -!.env.example +!.env.production diff --git a/frontend/Dockerfile b/frontend/Dockerfile index a176bdc..5377d3e 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -13,8 +13,7 @@ RUN npm install COPY . . # Build the Nuxt app -RUN npm run build - +RUN npm run build --dotenv .env.production # ---------- Production Stage ---------- FROM node:20-alpine diff --git a/frontend/app/assets/css/colors.scss b/frontend/app/assets/css/colors.scss index 6a35bb6..f0330ab 100644 --- a/frontend/app/assets/css/colors.scss +++ b/frontend/app/assets/css/colors.scss @@ -1,3 +1,5 @@ +@use "sass:map"; + $themes: ( dark: ( background: #141414, @@ -24,9 +26,9 @@ $themes: ( } :root { - @include theme-vars(map-get($themes, dark)); + @include theme-vars(map.get($themes, dark)); } [data-theme="light"] { - @include theme-vars(map-get($themes, light)); + @include theme-vars(map.get($themes, light)); } \ No newline at end of file diff --git a/frontend/app/composables/api.js b/frontend/app/composables/api.js new file mode 100644 index 0000000..9da341b --- /dev/null +++ b/frontend/app/composables/api.js @@ -0,0 +1,27 @@ +// composables/useApi.js +import { ref } from 'vue' + +export default function useApi() { + const config = useRuntimeConfig() + const baseUrl = config.public.apiBaseUrl + + // Generic GET request + const get = async (endpoint) => { + const res = await fetch(`${baseUrl}${endpoint}`) + if (!res.ok) throw new Error(`API GET ${endpoint} failed`) + return res.json() + } + + // Generic POST request + const post = async (endpoint, payload) => { + const res = await fetch(`${baseUrl}${endpoint}`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(payload) + }) + if (!res.ok) throw new Error(`API POST ${endpoint} failed`) + return res.json() + } + + return { get, post } +} \ No newline at end of file diff --git a/frontend/app/pages/index.vue b/frontend/app/pages/index.vue index 56d8347..cbd88f7 100644 --- a/frontend/app/pages/index.vue +++ b/frontend/app/pages/index.vue @@ -1,3 +1,18 @@ + +