Your project description goes here.
This is the frontend for Constitution Vault, a document management web application
- π Upload documents with metadata (name, writer, year, subject)
- π Search documents by title, writer, or subject
- π View documents inline (PDF rendering)
- ποΈ Select and delete one or more documents
- π¨ Clean, modern UI with sidebar navigation
public/
βββ index.html # Main homepage
βββ add.html # Upload document page
βββ read.html # Inline PDF viewer
βββ style.css # UI styles
βββ index.js # Logic for fetching, searching, deleting
βββ add.js # Handles file uploads
βββ read.js # Displays PDFs
βββ assets/ # (Optional) UI images, logos
- A running backend API (
http://localhost:3000
) connected to your Azure SQL database. - PDF documents are uploaded and stored as binary in the backend.
- Clone the Repository
git clone https://github.com/your-username/constitution-vault-frontend.git
cd constitution-vault-frontend
- Install Dependencies
Make sure you have Node.js and npm installed. Then run:
npm install
- Run the Development Server
To start the frontend application, run:
npm start
This will start the app on http://localhost:3000
, assuming your backend is running on that address.
This project uses Jest for testing. Follow the steps below to run the tests:
- Install Testing Dependencies
Make sure you have Jest installed by running:
npm install --save-dev jest jest-environment-jsdom
- Run Tests
To run tests with code coverage, run:
npx jest --coverage
This will run all the tests and generate a code coverage report.
- View the Test Results
Once the tests complete, you'll see the output in your terminal, indicating whether the tests passed and the coverage details.
index.html
β Lists all uploaded books and allows searching & deleting.add.html
β Form to upload a new book and PDF file.read.html?id=1
β View PDF inline based on book ID from URL.
The frontend makes requests to the following backend routes:
Method | Endpoint | Description |
---|---|---|
GET | /books |
Fetch all books |
POST | /upload |
Upload new document |
GET | /books/:id/document |
Fetch PDF for a book |
DELETE | /books/:id |
Delete a book by ID |
Coverage information is uploaded to Codecov, and you can view detailed reports there.