How hrishikeshsehan64/cache works
This is a small Express product CRUD API. Requests enter through the server and product routes; read routes check an in-memory, 60-second cache before controller handlers fetch data, while mutations clear the cache. The service layer delegates product operations to JSON-file persistence. The sampled source shows the main request and storage flows; no README documents additional capabilities.
Main entry points: productRoutes.js Product routes · productController.js Product controller · server.js Express server · productService.js Product service
Components 8
API routing
- Express server
server.js - Product routes
routes/productRoutes.js
Product logic
- Product controller
controllers/productController.js - Product service
services/productService.js
Product state
- Response cache
middleware/cache.js - Product persistence
database/productsDB.js - Product JSON file
db.json
Other components
- API client
Connections 8
- API client → Express server: sends requests
- Express server → Product routes: mounts routes
server.js - Product routes → Product controller: dispatches handlers
routes/productRoutes.js - Product routes → Response cache: checks reads
routes/productRoutes.js - Product controller → Product service: calls operations
controllers/productController.js - Product controller → Response cache: stores and clears
controllers/productController.js - Product service → Product persistence: delegates operations
services/productService.js - Product persistence → Product JSON file: reads and writes
database/productsDB.js