script pour setUp + fix pour localhost

demo_bourges
Thomas Chazot 1 year ago
parent f48168639a
commit 19957da05c

@ -7,7 +7,7 @@ const app = express();
const server = http.createServer(app); const server = http.createServer(app);
const io = socketIO(server, { const io = socketIO(server, {
cors: { cors: {
origin: ["http://172.20.10.4:3000", "http://172.20.10.4:3000"], // Remplacez par l'URL de votre application React origin: ["http://localhost:3000", "http://localhost:3000"], // Remplacez par l'URL de votre application React
methods: ["GET", "POST"], methods: ["GET", "POST"],
credentials: true credentials: true
} }

@ -1,6 +1,10 @@
const ADRESSE_WEBSERVER = "http://172.20.10.4:3002" const ADRESSE_WEBSERVER = "http://localhost:3002"
const ADRESSE_DBSERVER = "http://localhost:3003"
const tmp = ADRESSE_DBSERVER
const mp2 = ADRESSE_WEBSERVER
const ADRESSE_DBSERVER = "http://172.20.10.4:3003"
const ADRESSE_WEBSITE = "" const ADRESSE_WEBSITE = ""

@ -9,6 +9,8 @@ import { FormattedMessage } from 'react-intl';
import ButtonImgNav from '../Components/ButtonImgNav'; import ButtonImgNav from '../Components/ButtonImgNav';
import defaultImg from "../res/img/Person.png" import defaultImg from "../res/img/Person.png"
import {loadImageAsync} from "../ImageHelper" import {loadImageAsync} from "../ImageHelper"
import { socket } from '../SocketConfig';
import JSONParser from '../JSONParser';
// @ts-ignore // @ts-ignore

@ -351,7 +351,7 @@ const InGame = ({locale, changeLocale}) => {
<img src={Info} alt="info" height="40"/> <img src={Info} alt="info" height="40"/>
</button> </button>
</Link> </Link>
{/* <button className='button' onClick={() => openInNewTab('http://172.20.10.4:3000/play')}> //! avec url =={'>'} dangereux {/* <button className='button' onClick={() => openInNewTab('http://localhost:3000/play')}> //! avec url =={'>'} dangereux
<img src={Check} alt="check" height="40"/> <img src={Check} alt="check" height="40"/>
</button> */} </button> */}

@ -169,7 +169,7 @@ function Lobby() {
const copyGameLink = () => { const copyGameLink = () => {
setShow(!show) setShow(!show)
const gameLink = "http://172.20.10.4:3000/lobby?room="+ room; const gameLink = "http://localhost:3000/lobby?room="+ room;
navigator.clipboard.writeText(gameLink) navigator.clipboard.writeText(gameLink)
.then(() => { .then(() => {
console.log('Lien copié avec succès !'); console.log('Lien copié avec succès !');
@ -180,7 +180,7 @@ function Lobby() {
}; };
const textAreaRef = useRef<HTMLTextAreaElement>(null); const textAreaRef = useRef<HTMLTextAreaElement>(null);
const linkToCopy = "http://172.20.10.4:3000/lobby?room="+ room const linkToCopy = "http://localhost:3000/lobby?room="+ room
const handleCopyClick = () => { const handleCopyClick = () => {
setShow(!show) setShow(!show)
if(textAreaRef.current != null){ if(textAreaRef.current != null){

@ -140,7 +140,7 @@ const SoloGame = ({locale, changeLocale}) => {
<img src={Info} alt="info" height="40"/> <img src={Info} alt="info" height="40"/>
</button> </button>
</Link> </Link>
{/* <button className='button' onClick={() => openInNewTab('http://172.20.10.4:3000/play')}> //! avec url =={'>'} dangereux {/* <button className='button' onClick={() => openInNewTab('http://localhost:3000/play')}> //! avec url =={'>'} dangereux
<img src={Check} alt="check" height="40"/> <img src={Check} alt="check" height="40"/>
</button> */} </button> */}

@ -13,7 +13,7 @@ const port = 3003;
// Middleware // Middleware
app.use(cors( app.use(cors(
{ {
origin: ["http://172.20.10.4:3000", "http://172.20.10.4:3000"], origin: ["http://localhost:3000", "http://localhost:3000"],
credentials: true credentials: true
} }
)); // Autoriser les requêtes cross-origin )); // Autoriser les requêtes cross-origin

Loading…
Cancel
Save