diff --git a/backend/.dockerignore b/backend/.dockerignore new file mode 100644 index 0000000..e40a9a7 --- /dev/null +++ b/backend/.dockerignore @@ -0,0 +1,6 @@ +node_modules/ +.git/ +.gitignore +.npm/ +*.log +*.env diff --git a/backend/.env b/backend/.env index 28c7371..a8b9460 100644 --- a/backend/.env +++ b/backend/.env @@ -2,4 +2,4 @@ MONGODB_URI='mongodb://localhost:27017' MONGODB_NAME='docucenter' NODE_ENV='development' #If set to production it will require https to function JWT_SECRET='IjkAORBx^cLYpSb6Btz@te&vAJ3Pt*$z' - +FRONTEND_URL='http://localhost:3001' diff --git a/backend/server.js b/backend/server.js index 3383bda..dbea635 100644 --- a/backend/server.js +++ b/backend/server.js @@ -9,13 +9,16 @@ const documentRoutes = require('./src/routes/documentRoutes'); const app = express(); +const corsUrl = process.env.FRONTEND_URL; + app.use(express.urlencoded({ extended: true })); // Parses form data app.use(express.json()); // Parses JSON data // Configure CORS to allow specific origins const allowedOrigins = [ 'https://docucenter.mpe.ca', // Production frontend - 'http://localhost:5173', // Development frontend + 'http://localhost:5173', + corsUrl // Development frontend ]; const corsOptions = { diff --git a/backend/src/utils/database.js b/backend/src/utils/database.js index 422901b..ed989e4 100644 --- a/backend/src/utils/database.js +++ b/backend/src/utils/database.js @@ -1,6 +1,7 @@ const mongoose = require('mongoose'); const connectDB = async () => { + console.log("Trying to connect to " + process.env.MONGODB_URI); try { await mongoose.connect(process.env.MONGODB_URI+'/'+ process.env.MONGODB_NAME, { useNewUrlParser: true, diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 53aae52..9e12262 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -26,6 +26,7 @@ "@tiptap/pm": "^2.10.3", "@tiptap/starter-kit": "^2.10.3", "dotenv": "^16.4.7", + "dotenv-flow": "^4.1.0", "tippy.js": "^6.3.7" }, "devDependencies": { @@ -2058,6 +2059,17 @@ "url": "https://dotenvx.com" } }, + "node_modules/dotenv-flow": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/dotenv-flow/-/dotenv-flow-4.1.0.tgz", + "integrity": "sha512-0cwP9jpQBQfyHwvE0cRhraZMkdV45TQedA8AAUZMsFzvmLcQyc1HPv+oX0OOYwLFjIlvgVepQ+WuQHbqDaHJZg==", + "dependencies": { + "dotenv": "^16.0.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 5648eb6..2c6bea8 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -52,6 +52,7 @@ "@tiptap/pm": "^2.10.3", "@tiptap/starter-kit": "^2.10.3", "dotenv": "^16.4.7", + "dotenv-flow": "^4.1.0", "tippy.js": "^6.3.7" } } diff --git a/frontend/src/mpe_theme.ts b/frontend/src/mpe_theme.ts index 0ac7fbf..a690ea2 100644 --- a/frontend/src/mpe_theme.ts +++ b/frontend/src/mpe_theme.ts @@ -26,7 +26,7 @@ export const mpe_theme: CustomThemeConfig = { "--color-primary-200": "195 238 224", // #c3eee0 "--color-primary-300": "159 227 205", // #9fe3cd "--color-primary-400": "87 207 167", // #57cfa7 - "--color-primary-500": "15 186 129", // #0FBA81 + "--color-primary-500": "36 88 164", // #0FBA81 "--color-primary-600": "14 167 116", // #0ea774 "--color-primary-700": "11 140 97", // #0b8c61 "--color-primary-800": "9 112 77", // #09704d @@ -88,7 +88,7 @@ export const mpe_theme: CustomThemeConfig = { "--color-error-900": "104 12 58", // #680c3a // surface | #495a8f "--color-surface-50": "228 230 238", // #e4e6ee - "--color-surface-100": "219 222 233", // #dbdee9 + "--color-surface-100": "36 88 164", // #dbdee9 "--color-surface-200": "210 214 227", // #d2d6e3 "--color-surface-300": "182 189 210", // #b6bdd2 "--color-surface-400": "128 140 177", // #808cb1 diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte index 1fb907e..8b4f456 100644 --- a/frontend/src/routes/+layout.svelte +++ b/frontend/src/routes/+layout.svelte @@ -37,24 +37,28 @@ {#if dropDown} -
+
{#if $page.data.user.name} - + Signed in as
- {$page.data.user.name} + {$page.data.user.name}
- -
+ + +
+
{:else} - {dropDown = false;}}> + {/if}
{/if} diff --git a/frontend/src/routes/edit/+page.svelte b/frontend/src/routes/edit/+page.svelte index ad87660..435cc90 100644 --- a/frontend/src/routes/edit/+page.svelte +++ b/frontend/src/routes/edit/+page.svelte @@ -55,7 +55,6 @@ const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get('id'); // Get the `id` from the query string const url = `${PUBLIC_BASE_URL}/api/document/`+id; - console.log("Title value:", title); const edited_by = $page.data.user?.name; const token = $page.data.user?.token; diff --git a/frontend/src/routes/home/+page.svelte b/frontend/src/routes/home/+page.svelte index dce7f77..5b04a5e 100644 --- a/frontend/src/routes/home/+page.svelte +++ b/frontend/src/routes/home/+page.svelte @@ -1,7 +1,9 @@