diff --git a/client/src/models/Match.js b/client/src/models/Match.js deleted file mode 100644 index 22c2387..0000000 --- a/client/src/models/Match.js +++ /dev/null @@ -1,11 +0,0 @@ -export default class Match { - id; - minUsers; - MaxUsers; - registeredUsers; - dateTime; - duration; - sport; - difficulty; - title; -} \ No newline at end of file diff --git a/client/src/models/User.js b/client/src/models/User.js deleted file mode 100644 index c3c8ff4..0000000 --- a/client/src/models/User.js +++ /dev/null @@ -1,8 +0,0 @@ -export default class User { - firstName; - lastName; - email; - age; - biography; - id; -} \ No newline at end of file diff --git a/client/src/pages/Welcome.js b/client/src/pages/Welcome.js index 0799de1..c172574 100644 --- a/client/src/pages/Welcome.js +++ b/client/src/pages/Welcome.js @@ -1,8 +1,9 @@ import React from "react"; - +import { apiClient } from "../utils/httpClients"; export default class Welcome extends React.Component { constructor(props) { super(props); + this.recentMatchesRequest = apiClient.get("/match/recent/15"); } render() { diff --git a/client/src/utils/httpClients.js b/client/src/utils/httpClients.js new file mode 100644 index 0000000..a1d3187 --- /dev/null +++ b/client/src/utils/httpClients.js @@ -0,0 +1,6 @@ +import axios from "axios"; + +export const apiClient = axios.create({ + baseURL: process.env.API_HOST, + timeout: 5000, +}); \ No newline at end of file diff --git a/server/package-lock.json b/server/package-lock.json index f9277c7..c490f36 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -12,6 +12,7 @@ "bcrypt": "^5.0.1", "body-parser": "^1.19.2", "connect-mongo": "^4.6.0", + "cors": "^2.8.5", "express": "^4.17.3", "express-session": "^1.17.2", "mongoose": "^6.2.8", @@ -692,6 +693,18 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, + "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/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -3701,6 +3714,15 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, + "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" + } + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", diff --git a/server/package.json b/server/package.json index fe3b7df..9d930a2 100644 --- a/server/package.json +++ b/server/package.json @@ -20,6 +20,7 @@ "bcrypt": "^5.0.1", "body-parser": "^1.19.2", "connect-mongo": "^4.6.0", + "cors": "^2.8.5", "express": "^4.17.3", "express-session": "^1.17.2", "mongoose": "^6.2.8",