diff --git a/client/vite.config.js b/client/vite.config.js index 5a33944..7abe12a 100644 --- a/client/vite.config.js +++ b/client/vite.config.js @@ -3,5 +3,10 @@ import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ + server: { + allowedHosts: true, // Autorise tous les hôtes (le plus simple pour les previews) + // OU si tu veux être plus restrictif : + // allowedHosts: ['.sslip.io'], + }, plugins: [react()], }) diff --git a/docker-compose.yml b/docker-compose.yml index 5a15640..19b1058 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,14 +2,14 @@ services: postgres: container_name: database ports: - - "5431:5432" + - "5432" image: postgres environment: POSTGRES_USER: "${POSTGRES_USER}" POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}" POSTGRES_DB: ${POSTGRES_DB} volumes: - - ./docker_test_db:/var/lib/postgresql/data + - db-data:/var/lib/postgresql healthcheck: test: ["CMD-SHELL", "sh -c 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}'"] interval: 5s @@ -22,7 +22,7 @@ services: context: ./server dockerfile: Dockerfile ports: - - "7999:8000" + - "8000" command: bash -c "npx prisma migrate reset --force && npm start" environment: DATABASE_URL: "${DATABASE_URL}" @@ -35,8 +35,11 @@ services: build: context: ./client dockerfile: Dockerfile - command: bash -c "npm run preview" + command: 'bash -c "npm run preview -- --host 0.0.0.0 --strictPort"' ports: - - "4172:4173" + - "4173" depends_on: - server + +volumes: + db-data: diff --git a/server/src/app.js b/server/src/app.js index 82a3909..620a381 100644 --- a/server/src/app.js +++ b/server/src/app.js @@ -6,7 +6,9 @@ const dotenv = require("dotenv"); const HTTP_STATUS = require("./constants/httpStatus"); const prisma = require("./config/database"); dotenv.config(); -app.use(cors()); +app.use(cors({ + origin: '*', // Pour les previews, c'est le plus simple pour autoriser toutes les URLs sslip.io +})); router.get("/users/all", async (req, res) => { try {