Final Final Final

This commit is contained in:
2025-11-26 04:57:28 +00:00
parent bc6ca2be14
commit 6be151ba2e
+4 -33
View File
@@ -1,13 +1,13 @@
# COS498 HW3: PDF Document Management System
This is Homework 3 for **COS498: Server Side Programming Languages** that demonstrates a complete PDF document management system with custom routing, PDF discovery, and validation modules.
This is Homework 3 for **COS498: Server Side Programming Languages** that demonstrates a PDF document management system with custom routing and validation modules.
## Project Overview
This project implements a PDF document management system with the following features:
- **Frontend**: Nginx serving static files and Handlebars templates
- **Backend**: Node.js/Express server with custom routing and PDF management
- **PDF Management**: Comprehensive PDF discovery and validation system
- **PDF Management**: PDF validation and secure serving system
- **Security**: Path validation and access control for PDF serving
- **Database Integration**: SQLite database for book and chapter metadata
- **Containerization**: Docker containers orchestrated with Docker Compose
@@ -17,7 +17,6 @@ This project implements a PDF document management system with the following feat
### PDF Document Management
- **PDF Validation Module**: Comprehensive validation before serving any PDF
- **Custom Routing**: Dedicated routing module for book and chapter navigation
- **PDF Discovery**: Automatic discovery of PDF documents in designated folders
- **Security Controls**: Path validation and access restrictions
- **Database Integration**: SQLite database with books and chapters metadata
@@ -148,11 +147,6 @@ The backend provides the following endpoints:
- `GET /book/:bookName/chapter/:chapterFile` - Chapter viewer with PDF display
- `GET /pdf/:bookName/:chapterFile` - Direct PDF serving (with validation)
### Management Endpoints
- `GET /api/pdfs` - List all discovered PDFs
- `GET /api/books/discovery` - List all available books
- `POST /api/pdfs/refresh` - Force refresh PDF discovery cache
## Module Architecture
### 1. PDF Validation Module (`PDFValidationManager.js`)
@@ -178,20 +172,10 @@ The backend provides the following endpoints:
**Key Features**:
- Database integration for book/chapter metadata
- Fallback to file system discovery when database is empty
- Handlebars template rendering
- URL construction for PDF links
- Error handling and 404 responses
### 3. PDF Discovery Module (`PDFDiscoveryManager.js`) - Future Enhancement
**Purpose**: Automatically discover and catalog PDF documents
**Planned Features**:
- Folder scanning for PDF files
- Metadata extraction from filenames
- Caching system to avoid repeated file system reads
- Integration with database for metadata storage
## Architecture Details
### Frontend (Nginx + Handlebars)
@@ -253,21 +237,14 @@ The system includes sample data with the "Ways of the World" textbook by Strayer
- **Size Limits**: Prevents serving oversized files
- **Comprehensive Logging**: Security events logged for monitoring
### Database vs File System
- **Primary**: SQLite database with books and chapters metadata
- **Fallback**: File system discovery when database is empty
- **Hybrid Approach**: Combines database efficiency with file system flexibility
- **Future-Ready**: Architecture supports expansion to additional data sources
## Course Information
**Course**: COS498 - Server Side Programming Languages
**Assignment**: Homework 3 - PDF Document Management System
**Focus**: Demonstrating:
- Custom routing modules and URL handling
- PDF document discovery and management
- Comprehensive security validation systems
- Database integration with file system operations
- PDF validation and security systems
- Database integration with file operations
- Modular architecture and separation of concerns
## Implementation Requirements Met
@@ -278,12 +255,6 @@ The system includes sample data with the "Ways of the World" textbook by Strayer
- ✅ Handlebars template rendering with dynamic data
- ✅ URL construction for PDF links and navigation
### 2.4.2 PDF Discovery Module ✅
- ✅ `PDFDiscoveryManager.js` searches designated folders
- ✅ File system scanning and PDF cataloging
- ✅ Caching system to avoid repeated reads
- ✅ Metadata extraction from filenames and paths
### 2.4.3 PDF Validation Module ✅
- ✅ `PDFValidationManager.js` validates all PDF requests
- ✅ File existence verification before serving