Made some changes!

This commit is contained in:
Donavon McDowell 2024-12-18 11:53:42 -07:00
parent 80ac373d39
commit 80b951e216
2 changed files with 12 additions and 7 deletions

View File

@ -11,8 +11,8 @@ 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
app.use(express.urlencoded({ extended: true, limit: '50mb' })); // Increase URL-encoded payload limit
app.use(express.json({ limit: '50mb' })); // Increase JSON payload limit
// Configure CORS to allow specific origins
const allowedOrigins = [

View File

@ -26,7 +26,7 @@
// Function to simulate search API call
async function searchDocuments(query) {
try {
const res = await fetch(`http://localhost:3010/api/document/search?query=${query}`);
const res = await fetch(`https://docucenter.mpe.ca/api/document/search?query=${query}`);
const data = await res.json();
if (data.length > 0) {
@ -43,7 +43,7 @@
// Function to fetch all documents from the API
async function getAllDocuments() {
try {
const res = await fetch(`http://localhost:3010/api/document`);
const res = await fetch(`https://docucenter.mpe.ca/api/document`);
if (!res.ok) {
throw new Error(`Failed to fetch documents: ${res.statusText}`);
@ -77,7 +77,6 @@
<svelte:head>
<title>DocuCenter</title>
</svelte:head>
<div class="flex items-center justify-center h-full flex-col">
{#if $page.data.user.role == "admin"}
<div class="flex flex-row justify-end w-full">
@ -129,10 +128,16 @@
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 mt-4">
{#each documents as document}
<a href="/document?id={document._id}" class="block">
<div class="bg-white rounded-2xl p-4 font-roboto border mt-1 mb-1 hover:bg-slate-200 truncate h-48 shadow-lg">
<div class="relative bg-white rounded-2xl p-4 font-roboto border mt-1 mb-1 hover:bg-slate-200 truncate h-48 shadow-lg">
<h3 class="text-lg font-semibold">{@html document.title}</h3>
<p class="text-sm text-gray-600">{@html truncateBody(document.body)}</p>
<div class="absolute bottom-1 right-1 flex flex-row overflow-x-none">
{#each document.tags as tag}
<div class="rounded-xl px-3 p-1 items-center bg-blue-500 text-white space-x-2 mr-1 border-dashed border-blue-100 border-2">
<p>{@html tag}</p>
</div>
{/each}
</div>
</div>
</a>
{/each}