Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
})
13 changes: 8 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"
Expand All @@ -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:
4 changes: 3 additions & 1 deletion server/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down