From 3d514783af7f0535d23475486e0cab540fa7b3f1 Mon Sep 17 00:00:00 2001 From: bitsearch Date: Fri, 9 Jan 2026 13:52:48 +0100 Subject: [PATCH 1/2] changement dans .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 16b0f5d..e909572 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ srcs/.DS_Store +*.DS_Store \ No newline at end of file From 883327cee848e7f78a0a786098a45e42e3d84ca2 Mon Sep 17 00:00:00 2001 From: bitsearch Date: Fri, 9 Jan 2026 14:20:34 +0100 Subject: [PATCH 2/2] ajout de frontend fonctionnel :) --- docker-compose.yml | 28 ++++++++++++---------------- srcs/backend/index.js | 2 +- srcs/frontend/dockerfile | 4 ++-- srcs/frontend/nginx.conf | 18 ++++++++++++++++++ 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 62847d7..8101ca0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,8 +22,8 @@ services: backend: container_name: backend build: ./srcs/backend - ports: - - "3001:3001" + expose: + - "3001" depends_on: - database # volumes: @@ -34,17 +34,13 @@ services: - transcendence restart: always - # frontend: - # container_name: frontend - # build: ./docker/frontend - # ports: - # - "3000:3000" - # depends_on: - # - backend - # volumes: - # // - # env_file: - # // - # networks: - # - transcendence - # restart: always \ No newline at end of file + frontend: + container_name: frontend + build: ./srcs/frontend/ + ports: + - "8080:80" + depends_on: + - backend + networks: + - transcendence + restart: always \ No newline at end of file diff --git a/srcs/backend/index.js b/srcs/backend/index.js index 4d3fa6b..b40a53a 100644 --- a/srcs/backend/index.js +++ b/srcs/backend/index.js @@ -76,7 +76,7 @@ async function startServer() await createTables(); - app.get('/', (req, res) => res.send('Backend running')); + app.get('/api/', (req, res) => res.send('Backend running')); app.listen(3001, () => { diff --git a/srcs/frontend/dockerfile b/srcs/frontend/dockerfile index 1f73e22..24ef78a 100644 --- a/srcs/frontend/dockerfile +++ b/srcs/frontend/dockerfile @@ -1,5 +1,5 @@ -FROM nginx:20-alpine +FROM nginx:alpine COPY src /usr/share/nginx/html -COPY nginx.conf /etc/nginx/nginx.conf +COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/srcs/frontend/nginx.conf b/srcs/frontend/nginx.conf index e69de29..5e6a4b1 100644 --- a/srcs/frontend/nginx.conf +++ b/srcs/frontend/nginx.conf @@ -0,0 +1,18 @@ +server { + listen 80; + + root /usr/share/nginx/html; + index index.html; + + # Frontend + location / { + try_files $uri /index.html; + } + + # Backend API + location /api/ { + proxy_pass http://backend:3001/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } +}