diff --git a/README.md b/README.md index f5db2a2..976da46 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ bun install ## Development Server -Start the development server on `http://localhost:3000`: +Start the development server on `https://localhost:3000`: ```bash # npm -npm run dev +npm run dev -- --host 0.0.0.0 # pnpm pnpm run dev diff --git a/backend/index.js b/backend/index.js index 619515d..ee388a2 100644 --- a/backend/index.js +++ b/backend/index.js @@ -15,12 +15,15 @@ import fs from "fs"; //import routes import Router from "./routes/routes.js"; +import clientsideConfig from '~/clientsideConfig.js'; + //init express const app = express(); //setup cors const corsOptions = { - origin: 'https://localhost:3000', + // origin: `https://localhost:3000`, + origin: `https://${clientsideConfig.url}:${clientsideConfig.port}`, headers: 'authorization, content-type', methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', credentials: true, diff --git a/clientsideConfig.js b/clientsideConfig.js index a618f85..3c793c4 100644 --- a/clientsideConfig.js +++ b/clientsideConfig.js @@ -1,6 +1,6 @@ const clientsideConfig = { + // later for the server // url: 'tueitapp.tueit.de', - // port: 8000, url: 'localhost', port: 3000, }; diff --git a/components/LoginForm.vue b/components/LoginForm.vue index 6571fd2..cd0fff3 100644 --- a/components/LoginForm.vue +++ b/components/LoginForm.vue @@ -49,7 +49,7 @@ import { useRouter } from 'vue-router'; import { ref } from 'vue'; import Axios from '../axios.config.js'; -import serversideConfig from '../serversideConfig.js'; +import clientsideConfig from '../clientsideConfig.js'; const router = useRouter(); const darkMode = ref(true); @@ -69,7 +69,7 @@ const handleLogin = async () => { } try { - let res = await Axios.post(`https://${serversideConfig.url}:3000/api/login`, requestBody); + let res = await Axios.post(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/login`, requestBody); // something to do with the res? console.log(res.data) @@ -123,7 +123,7 @@ const testFunctionSignup = async () => { } try { - let res = await Axios.post(`https://${serversideConfig.url}:3000/api/signup`, requestBody); + let res = await Axios.post(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/signup`, requestBody); // something to do with the res? console.log(res.data) diff --git a/components/server/Asset.vue b/components/server/Asset.vue index ad3f49a..141c78a 100644 --- a/components/server/Asset.vue +++ b/components/server/Asset.vue @@ -76,7 +76,7 @@