From b0cc6bcd565b75b3d4ab6ffaf75b2652305e28b5 Mon Sep 17 00:00:00 2001 From: UO276026 Date: Thu, 21 Mar 2024 10:20:25 +0100 Subject: [PATCH] Cors arreglado --- package.json | 4 ++-- questionservice/server.js | 4 ++-- webapp/package-lock.json | 22 ++++++++++++++++++++++ webapp/package.json | 1 + webapp/src/components/Pages/Juego.js | 2 ++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 033086f..d69bb21 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "devDependencies": { - "@babel/plugin-proposal-private-property-in-object": "^7.21.11" + "@babel/plugin-proposal-private-property-in-object": "^7.21.11" } - } \ No newline at end of file +} diff --git a/questionservice/server.js b/questionservice/server.js index fbfacb3..a1420cb 100644 --- a/questionservice/server.js +++ b/questionservice/server.js @@ -2,11 +2,11 @@ const express = require('express'); // Importamos el módulo Axios para realizar solicitudes HTTP const axios = require('axios'); -//const cors = require('cors'); +const cors = require('cors'); // Creamos una nueva aplicación Express const app = express(); -//app.use(cors()); +app.use(cors()); // Definimos una ruta GET en '/pregunta' app.get('/pregunta', async (req, res) => { diff --git a/webapp/package-lock.json b/webapp/package-lock.json index e6ee834..b8d5cfc 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -16,6 +16,7 @@ "@testing-library/user-event": "^14.5.2", "axios": "^1.6.5", "bootstrap": "^5.3.3", + "cors": "^2.8.5", "firebase": "^10.8.0", "react": "^18.2.0", "react-bootstrap": "^2.10.1", @@ -9143,6 +9144,18 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/cosmiconfig": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", @@ -35184,6 +35197,15 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, "cosmiconfig": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", diff --git a/webapp/package.json b/webapp/package.json index b9e333a..656a362 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -11,6 +11,7 @@ "@testing-library/user-event": "^14.5.2", "axios": "^1.6.5", "bootstrap": "^5.3.3", + "cors": "^2.8.5", "firebase": "^10.8.0", "react": "^18.2.0", "react-bootstrap": "^2.10.1", diff --git a/webapp/src/components/Pages/Juego.js b/webapp/src/components/Pages/Juego.js index 0557d24..a746331 100644 --- a/webapp/src/components/Pages/Juego.js +++ b/webapp/src/components/Pages/Juego.js @@ -5,6 +5,8 @@ import '../Estilos/juego.css'; import { Container, Typography, TextField, Button, Snackbar } from '@mui/material'; import Temporizador from '../Temporizador'; + + const Juego = ({isLogged}) => { //La pregunta (string) const [pregunta, setPregunta] = useState("")