This commit is contained in:
@@ -7,8 +7,9 @@ const connectDB = require("./db");
|
|||||||
// connect database
|
// connect database
|
||||||
connectDB();
|
connectDB();
|
||||||
|
|
||||||
app.get("/", (req, res) => {
|
app.get("/api/test", (req, res) => {
|
||||||
res.send("Hello from Proxmox container!");
|
console.log("Hey");
|
||||||
|
res.json({"message": "Hello from backend!"});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(5000, () => {
|
app.listen(5000, () => {
|
||||||
|
|||||||
1
frontend/.env.production
Normal file
1
frontend/.env.production
Normal file
@@ -0,0 +1 @@
|
|||||||
|
API_BASE_URL=https://aranroig.com/api
|
||||||
2
frontend/.gitignore
vendored
2
frontend/.gitignore
vendored
@@ -21,4 +21,4 @@ logs
|
|||||||
# Local env files
|
# Local env files
|
||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.production
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ RUN npm install
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build the Nuxt app
|
# Build the Nuxt app
|
||||||
RUN npm run build
|
RUN npm run build --dotenv .env.production
|
||||||
|
|
||||||
|
|
||||||
# ---------- Production Stage ----------
|
# ---------- Production Stage ----------
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@use "sass:map";
|
||||||
|
|
||||||
$themes: (
|
$themes: (
|
||||||
dark: (
|
dark: (
|
||||||
background: #141414,
|
background: #141414,
|
||||||
@@ -24,9 +26,9 @@ $themes: (
|
|||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
@include theme-vars(map-get($themes, dark));
|
@include theme-vars(map.get($themes, dark));
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-theme="light"] {
|
[data-theme="light"] {
|
||||||
@include theme-vars(map-get($themes, light));
|
@include theme-vars(map.get($themes, light));
|
||||||
}
|
}
|
||||||
27
frontend/app/composables/api.js
Normal file
27
frontend/app/composables/api.js
Normal file
@@ -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 }
|
||||||
|
}
|
||||||
@@ -1,3 +1,18 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import api from '~/composables/api'
|
||||||
|
const { get, post } = api();
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
console.log("Getting")
|
||||||
|
const response = await get('/test');
|
||||||
|
console.log('API Response:', response);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('API Error:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h1>ARANROIG.COM</h1>
|
<h1>ARANROIG.COM</h1>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,21 +2,28 @@
|
|||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
compatibilityDate: '2025-07-15',
|
compatibilityDate: '2025-07-15',
|
||||||
devtools: { enabled: true },
|
devtools: { enabled: true },
|
||||||
|
|
||||||
css: [
|
css: [
|
||||||
'~/assets/css/colors.scss',
|
'~/assets/css/colors.scss',
|
||||||
'~/assets/css/fonts.scss',
|
'~/assets/css/fonts.scss',
|
||||||
'~/assets/css/main.scss'
|
'~/assets/css/main.scss'
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
runtimeConfig: {
|
||||||
|
public: {
|
||||||
|
apiBaseUrl: process.env.API_BASE_URL || 'http://localhost:5000/api'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
i18n: {
|
i18n: {
|
||||||
locales: [
|
locales: [
|
||||||
{ code: 'en', iso: 'en-US', name: 'English', file: 'en.json' },
|
{ code: 'en', iso: 'en-US', name: 'English', file: 'en.json' },
|
||||||
{ code: 'es', iso: 'es-ES', name: 'Spanish', file: 'es.json' },
|
{ code: 'es', iso: 'es-ES', name: 'Spanish', file: 'es.json' },
|
||||||
{ code: 'ca', iso: 'ca-ES', nane: 'Catalan', file: 'ca.json' }
|
{ code: 'ca', iso: 'ca-ES', name: 'Catalan', file: 'ca.json' }
|
||||||
],
|
],
|
||||||
defaultLocale: 'en',
|
defaultLocale: 'en',
|
||||||
langDir: 'locales/'
|
langDir: 'locales/'
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
|
modules: ['@nuxtjs/i18n']
|
||||||
})
|
})
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
"postinstall": "nuxt prepare"
|
"postinstall": "nuxt prepare"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@nuxtjs/i18n": "10.2.3",
|
||||||
"nuxt": "^4.3.1",
|
"nuxt": "^4.3.1",
|
||||||
"sass": "^1.98.0",
|
"sass": "^1.98.0",
|
||||||
"vue": "^3.5.30",
|
"vue": "^3.5.30",
|
||||||
|
|||||||
1581
frontend/pnpm-lock.yaml
generated
1581
frontend/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -14,5 +14,8 @@
|
|||||||
{
|
{
|
||||||
"path": "./.nuxt/tsconfig.node.json"
|
"path": "./.nuxt/tsconfig.node.json"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"compilerOptions": {
|
||||||
|
"types": ["node"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
nginx.conf
12
nginx.conf
@@ -5,6 +5,7 @@ http {
|
|||||||
listen 80;
|
listen 80;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
|
# Normal requests
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://frontend:3000;
|
proxy_pass http://frontend:3000;
|
||||||
|
|
||||||
@@ -14,5 +15,16 @@ http {
|
|||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Api Requests
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://backend:5000;
|
||||||
|
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user