feat: dockerize client (nginx) and server (node) with docker-compose

This commit is contained in:
kevin.lhereec committed 2026-08-17 11:44:07 +02:00
1 parent 38814668e7
commit 8da1d1edc9
12 files changed
+143 -3

No files matched your search

+6 -3
View File
@@ -4,9 +4,12 @@ let socket = null
export function useSocket() {
if (!socket) {
socket = io(import.meta.env.VITE_SERVER_URL || 'http://localhost:3000', {
autoConnect: true
})
// En dev : pointe vers localhost:3000
// En prod Docker : connexion sur la même origine (nginx proxifie /socket.io)
const url = import.meta.env.VITE_SERVER_URL || (
import.meta.env.PROD ? window.location.origin : 'http://localhost:3000'
)
socket = io(url, { autoConnect: true })
}
return socket
}