-
Notifications
You must be signed in to change notification settings - Fork 0
Caching moved to CDN #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…inor version upgrades
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request removes all in-memory backend caching infrastructure from the API, delegating caching responsibility to the CDN layer. The changes simplify the codebase by eliminating cache management complexity while maintaining appropriate cache-control headers for CDN utilization. Additionally, the PR updates the Node.js version requirement to 22+ and significantly expands test coverage for the static file serving endpoint.
Key changes:
- Removed all in-memory caching logic, cache helper functions, and cache management endpoints (
/v1/cache-statsand/v1/cache-reset) - Updated Node.js version requirement from 18+ to 22+ in both README and package.json
- Expanded static file serving tests to cover MIME type detection, CORS handling, ETag/conditional requests, error scenarios, and directory traversal protection
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/controllerHelpers.js | Removed cache data structures (queryResultCache, latestDateCache), cache helper functions (getCachedQueryResult, setCachedQueryResult, getCacheStats, resetCache), and simplified executeQuery function signature by removing customCacheKeyData parameter |
| src/controllers/reportController.js | Removed cache-related imports and inline caching logic from query execution flow |
| src/controllers/categoriesController.js | Removed customCacheKeyData parameter from executeQuery call |
| src/controllers/technologiesController.js | Removed customCacheKeyData parameter from executeQuery call |
| src/index.js | Removed cache management endpoint routes (/v1/cache-stats and /v1/cache-reset) |
| src/controllers/cdnController.js | Removed redundant response headers (Cache-Control, CORS) as they are now set globally in index.js |
| test-api.sh | Removed cache endpoint tests |
| src/tests/routes.test.js | Replaced cache management tests with comprehensive static file serving tests covering valid requests, directory traversal protection, 404 handling, conditional requests, error scenarios, and MIME type detection |
| README.md | Updated Node.js version requirement from 18+ to 22+, removed all cache-related endpoint documentation while preserving reference to cache headers for static data |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request removes all in-memory backend caching and related endpoints from the API, simplifying the codebase and documentation. It also updates the Node.js version requirement and improves static file serving tests for better coverage and robustness.
Key changes:
1. Removal of In-Memory Caching and Cache Endpoints
controllerHelpers.js,reportController.js,categoriesController.js, andtechnologiesController.js. This includes the deletion of/v1/cache-statsand/v1/cache-resetendpoints and their documentation.2. Documentation Updates
README.mdhas been updated to remove all references to backend caching, cache-related endpoints, and to clarify that static data is still served with cache headers. The Node.js version requirement is updated from 18+ to 22+.3. Static File Serving and Testing Improvements
/v1/static/*endpoint has been significantly expanded to cover valid/invalid file requests, MIME type detection, CORS handling, ETag/conditional requests, error scenarios, and directory traversal protection. This ensures robust validation and correct behavior for static file proxying.4. Response Header Adjustments
cdnController.jsto align with the new caching strategy.