feat: implement API response caching with node-cache
- Add in-memory cache middleware with configurable TTL - Cache GET endpoints: streets (5min), events (2min), posts (1min), rewards (10min) - Automatic cache invalidation on POST/PUT/DELETE operations - Add cache statistics endpoint (GET /api/cache/stats) - Add cache management endpoint (DELETE /api/cache) - Cache hit rate tracking and monitoring - Pattern-based cache invalidation - Optimized for Raspberry Pi deployment (lightweight in-memory) 🤖 Generated with Claude Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -136,6 +136,7 @@ const badgesRoutes = require("./routes/badges");
|
||||
const aiRoutes = require("./routes/ai");
|
||||
const paymentRoutes = require("./routes/payments");
|
||||
const userRoutes = require("./routes/users");
|
||||
const cacheRoutes = require("./routes/cache");
|
||||
|
||||
// Apply rate limiters
|
||||
app.use("/api/auth/register", authLimiter);
|
||||
@@ -236,6 +237,7 @@ app.use("/api/badges", badgesRoutes);
|
||||
app.use("/api/ai", aiRoutes);
|
||||
app.use("/api/payments", paymentRoutes);
|
||||
app.use("/api/users", userRoutes);
|
||||
app.use("/api/cache", cacheRoutes);
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.send("Street Adoption App Backend");
|
||||
|
||||
Reference in New Issue
Block a user