mirror of
https://github.com/donavon04/DocuCenter.git
synced 2025-01-18 09:40:56 -07:00
Banging head against a wall
This commit is contained in:
parent
629bd7e4f2
commit
80ac373d39
6
backend/.dockerignore
Normal file
6
backend/.dockerignore
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
node_modules/
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.npm/
|
||||||
|
*.log
|
||||||
|
*.env
|
@ -2,4 +2,4 @@ MONGODB_URI='mongodb://localhost:27017'
|
|||||||
MONGODB_NAME='docucenter'
|
MONGODB_NAME='docucenter'
|
||||||
NODE_ENV='development' #If set to production it will require https to function
|
NODE_ENV='development' #If set to production it will require https to function
|
||||||
JWT_SECRET='IjkAORBx^cLYpSb6Btz@te&vAJ3Pt*$z'
|
JWT_SECRET='IjkAORBx^cLYpSb6Btz@te&vAJ3Pt*$z'
|
||||||
|
FRONTEND_URL='http://localhost:3001'
|
||||||
|
@ -9,13 +9,16 @@ const documentRoutes = require('./src/routes/documentRoutes');
|
|||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
|
const corsUrl = process.env.FRONTEND_URL;
|
||||||
|
|
||||||
app.use(express.urlencoded({ extended: true })); // Parses form data
|
app.use(express.urlencoded({ extended: true })); // Parses form data
|
||||||
app.use(express.json()); // Parses JSON data
|
app.use(express.json()); // Parses JSON data
|
||||||
|
|
||||||
// Configure CORS to allow specific origins
|
// Configure CORS to allow specific origins
|
||||||
const allowedOrigins = [
|
const allowedOrigins = [
|
||||||
'https://docucenter.mpe.ca', // Production frontend
|
'https://docucenter.mpe.ca', // Production frontend
|
||||||
'http://localhost:5173', // Development frontend
|
'http://localhost:5173',
|
||||||
|
corsUrl // Development frontend
|
||||||
];
|
];
|
||||||
|
|
||||||
const corsOptions = {
|
const corsOptions = {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const mongoose = require('mongoose');
|
const mongoose = require('mongoose');
|
||||||
|
|
||||||
const connectDB = async () => {
|
const connectDB = async () => {
|
||||||
|
console.log("Trying to connect to " + process.env.MONGODB_URI);
|
||||||
try {
|
try {
|
||||||
await mongoose.connect(process.env.MONGODB_URI+'/'+ process.env.MONGODB_NAME, {
|
await mongoose.connect(process.env.MONGODB_URI+'/'+ process.env.MONGODB_NAME, {
|
||||||
useNewUrlParser: true,
|
useNewUrlParser: true,
|
||||||
|
12
frontend/package-lock.json
generated
12
frontend/package-lock.json
generated
@ -26,6 +26,7 @@
|
|||||||
"@tiptap/pm": "^2.10.3",
|
"@tiptap/pm": "^2.10.3",
|
||||||
"@tiptap/starter-kit": "^2.10.3",
|
"@tiptap/starter-kit": "^2.10.3",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
|
"dotenv-flow": "^4.1.0",
|
||||||
"tippy.js": "^6.3.7"
|
"tippy.js": "^6.3.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -2058,6 +2059,17 @@
|
|||||||
"url": "https://dotenvx.com"
|
"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": {
|
"node_modules/eastasianwidth": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
"@tiptap/pm": "^2.10.3",
|
"@tiptap/pm": "^2.10.3",
|
||||||
"@tiptap/starter-kit": "^2.10.3",
|
"@tiptap/starter-kit": "^2.10.3",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
|
"dotenv-flow": "^4.1.0",
|
||||||
"tippy.js": "^6.3.7"
|
"tippy.js": "^6.3.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ export const mpe_theme: CustomThemeConfig = {
|
|||||||
"--color-primary-200": "195 238 224", // #c3eee0
|
"--color-primary-200": "195 238 224", // #c3eee0
|
||||||
"--color-primary-300": "159 227 205", // #9fe3cd
|
"--color-primary-300": "159 227 205", // #9fe3cd
|
||||||
"--color-primary-400": "87 207 167", // #57cfa7
|
"--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-600": "14 167 116", // #0ea774
|
||||||
"--color-primary-700": "11 140 97", // #0b8c61
|
"--color-primary-700": "11 140 97", // #0b8c61
|
||||||
"--color-primary-800": "9 112 77", // #09704d
|
"--color-primary-800": "9 112 77", // #09704d
|
||||||
@ -88,7 +88,7 @@ export const mpe_theme: CustomThemeConfig = {
|
|||||||
"--color-error-900": "104 12 58", // #680c3a
|
"--color-error-900": "104 12 58", // #680c3a
|
||||||
// surface | #495a8f
|
// surface | #495a8f
|
||||||
"--color-surface-50": "228 230 238", // #e4e6ee
|
"--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-200": "210 214 227", // #d2d6e3
|
||||||
"--color-surface-300": "182 189 210", // #b6bdd2
|
"--color-surface-300": "182 189 210", // #b6bdd2
|
||||||
"--color-surface-400": "128 140 177", // #808cb1
|
"--color-surface-400": "128 140 177", // #808cb1
|
||||||
|
@ -37,24 +37,28 @@
|
|||||||
|
|
||||||
{#if dropDown}
|
{#if dropDown}
|
||||||
<!-- Dropdown menu -->
|
<!-- Dropdown menu -->
|
||||||
<div class="absolute right-0 mt-2 bg-white shadow-lg rounded-md p-4 z-50 text-nowrap">
|
<div class="absolute right-0 mt-2 bg-white shadow-lg rounded-md z-50 text-nowrap">
|
||||||
{#if $page.data.user.name}
|
{#if $page.data.user.name}
|
||||||
<span class="signedInText block mb-2 text-sm">
|
<span class="signedInText block mb-2 text-sm pl-2 pr-2 pt-2">
|
||||||
<small>Signed in as</small><br/>
|
<small>Signed in as</small><br/>
|
||||||
<b>{$page.data.user.name}</b>
|
<b>{$page.data.user.name}</b><br>
|
||||||
</span>
|
</span>
|
||||||
|
<a href="/settings" class="font-roboto w-full text-lg">
|
||||||
<form action="/logout" method="POST">
|
<button class="w-full hover:bg-slate-200 pt-2 pb-2">Settings</button>
|
||||||
|
</a><br>
|
||||||
|
<form action="/logout" method="POST" class="w-full p-3">
|
||||||
<button class="bg-blue-500 text-white px-4 py-2 rounded-3xl hover:bg-blue-400 text-nowrap w-full">Sign Out</button>
|
<button class="bg-blue-500 text-white px-4 py-2 rounded-3xl hover:bg-blue-400 text-nowrap w-full">Sign Out</button>
|
||||||
</form>
|
</form>
|
||||||
{:else}
|
{:else}
|
||||||
<a href="/login" on:click={() => {dropDown = false;}}>
|
<div class="w-full p-2">
|
||||||
|
<a href="/login" on:click={() => {dropDown = false;}}>
|
||||||
<button
|
<button
|
||||||
class="bg-blue-500 text-white px-4 py-2 rounded-3xl hover:bg-blue-400 text-nowrap w-full"
|
class="bg-blue-500 text-white px-4 py-2 rounded-3xl hover:bg-blue-400 text-nowrap w-full"
|
||||||
>
|
>
|
||||||
Sign In
|
Sign In
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const id = urlParams.get('id'); // Get the `id` from the query string
|
const id = urlParams.get('id'); // Get the `id` from the query string
|
||||||
const url = `${PUBLIC_BASE_URL}/api/document/`+id;
|
const url = `${PUBLIC_BASE_URL}/api/document/`+id;
|
||||||
console.log("Title value:", title);
|
|
||||||
|
|
||||||
const edited_by = $page.data.user?.name;
|
const edited_by = $page.data.user?.name;
|
||||||
const token = $page.data.user?.token;
|
const token = $page.data.user?.token;
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { page } from "$app/stores"
|
import { page } from "$app/stores"
|
||||||
import { PUBLIC_BASE_URL } from '$env/static/public';
|
//import { PUBLIC_BASE_URL } from '$env/static/public';
|
||||||
|
//import { PUBLIC_BASE_URL } from '$env/dynamic/private'
|
||||||
|
|
||||||
|
|
||||||
let query = false;
|
let query = false;
|
||||||
let searchQuery = "";
|
let searchQuery = "";
|
||||||
@ -24,7 +26,7 @@
|
|||||||
// Function to simulate search API call
|
// Function to simulate search API call
|
||||||
async function searchDocuments(query) {
|
async function searchDocuments(query) {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${PUBLIC_BASE_URL}/api/document/search?query=${query}`);
|
const res = await fetch(`http://localhost:3010/api/document/search?query=${query}`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
@ -41,7 +43,7 @@
|
|||||||
// Function to fetch all documents from the API
|
// Function to fetch all documents from the API
|
||||||
async function getAllDocuments() {
|
async function getAllDocuments() {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${PUBLIC_BASE_URL}/api/document`);
|
const res = await fetch(`http://localhost:3010/api/document`);
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error(`Failed to fetch documents: ${res.statusText}`);
|
throw new Error(`Failed to fetch documents: ${res.statusText}`);
|
||||||
@ -55,8 +57,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Function to truncate the body text to 100 words
|
// Function to truncate the body text to 100 words
|
||||||
function truncateBody(body) {
|
function truncateBody(body) {
|
||||||
const words = body.split(' ');
|
const words = body.split(' ');
|
||||||
@ -69,7 +69,6 @@
|
|||||||
// Fetch all documents on component mount
|
// Fetch all documents on component mount
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
documents = await getAllDocuments();
|
documents = await getAllDocuments();
|
||||||
console.log("Fetched documents:", documents);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let message = "Hello";
|
let message = "Hello";
|
||||||
|
0
frontend/src/routes/settings/+page.svelte
Normal file
0
frontend/src/routes/settings/+page.svelte
Normal file
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in New Issue
Block a user