Implemented three new REST endpoints for serving extracted images from documents: - GET /api/documents/:id/images - Returns all images for a document - GET /api/documents/:id/pages/:pageNum/images - Returns images for specific page - GET /api/images/:imageId - Streams image file (PNG/JPEG) with proper headers Features: - Full access control verification using existing auth patterns - Secure file serving with path traversal protection - Proper Content-Type and caching headers - Rate limiting for image endpoints - Comprehensive error handling for invalid IDs and missing files - JSON responses with image metadata including OCR text and positioning Testing: - Created comprehensive test suite (test-image-endpoints.sh) - All endpoints tested with curl and verified working - Error cases properly handled (404, 403, 400) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| config | ||
| db | ||
| examples | ||
| middleware | ||
| migrations | ||
| routes | ||
| scripts | ||
| services | ||
| test/data | ||
| workers | ||
| .env.example | ||
| API_SUMMARY.md | ||
| index.js | ||
| package.json | ||
| run-migration.js | ||
| test-routes.js | ||